Giter VIP home page Giter VIP logo

Comments (10)

nijikokun avatar nijikokun commented on August 18, 2024

How are you trying to use the module?

from grade.

danielfonda avatar danielfonda commented on August 18, 2024

I'm actually trying to use it with Wordpress. I've renamed the resource .js file to grade.js
Enqueued the file in the header (which shouldn't be an issue, seeing as other .js files run fine).
I've then added this (before the opening footer tag):
<script type="text/javascript"> window.addEventListener('load', function(){ /* A NodeList of all your image containers (Or a single Node). The library will locate an <img /> within each container to create the gradient from. */ Grade(document.querySelectorAll('.thumbnail_grad')) }) </script>

This results in the aforementioned error and just ends up not working.

Let me add that js hint (Atom) - also outputs a bunch of errors (most of them following this example):
"W104 - 'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).at line 1 col 1"

from grade.

nijikokun avatar nijikokun commented on August 18, 2024

You're going to want to compile it for browser usage, not rename it.

babel src/index.js --out-file grade.js

from grade.

benhowdle89 avatar benhowdle89 commented on August 18, 2024

Hey Daniel,

From the README:

Download this repo and grab the grade.js file from the /docs/dist folder.

So you shouldn't need to compile anything, just copy that file into your project and reference it from a script tag,

Hope this helps

from grade.

danielfonda avatar danielfonda commented on August 18, 2024

@benhowdle89 @nijikokun Thanks for the help - will try again and let you know how it goes.
Only issue that I may have however, is that the index.html file is the docs folder results in the following:
http://www.awesomescreenshot.com/image/1504079/927134018a4ee807d78acd196ed720ac

In other words - I don't think it works in the example provided in the download folder.

from grade.

kgengler avatar kgengler commented on August 18, 2024

you're probably seeing the same problem as issue #5

from grade.

danielfonda avatar danielfonda commented on August 18, 2024

Does this require a web server to work? I'll test it out and report back.

from grade.

danielfonda avatar danielfonda commented on August 18, 2024

I can confirm that it works with wamp - launched from a server, rather than desktop.

from grade.

benhowdle89 avatar benhowdle89 commented on August 18, 2024

Excellent, glad you got it working!

from grade.

clooth avatar clooth commented on August 18, 2024

@benhowdle89 Just a quick question, why don't you compile a transpiled module before deploying to npm and just set "main": "lib/index.js"? Then you wouldn't need to have babel when using the package.

from grade.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.