Giter VIP home page Giter VIP logo

Comments (12)

bitwalker avatar bitwalker commented on August 26, 2024

Sure, I can do that. I should probably refactor things a bit to bring it more up to date, but for now I'll see if I can't just get a package definition pushed and get it up on npmjs.com.

from keys.js.

jamesfzhang avatar jamesfzhang commented on August 26, 2024

Thanks @bitwalker, much appreciated!

from keys.js.

bitwalker avatar bitwalker commented on August 26, 2024

Done! https://www.npmjs.com/package/keys.js

from keys.js.

jamesfzhang avatar jamesfzhang commented on August 26, 2024

@bitwalker How do you require keys?

I've tried these, no luck

require('keys.js');
require('keys');

from keys.js.

bitwalker avatar bitwalker commented on August 26, 2024

@jamesfzhang Let me take a look, it should just work. Are you using ES6/2015-style require/import, or require.js/some variant?

from keys.js.

jamesfzhang avatar jamesfzhang commented on August 26, 2024

I'm using ES6 style via https://github.com/browserify-rails/browserify-rails

from keys.js.

bitwalker avatar bitwalker commented on August 26, 2024

@jamesfzhang cool, I'll take a look and get back to you soon

from keys.js.

bitwalker avatar bitwalker commented on August 26, 2024

@jamesfzhang Found the issue, I can now require the script in Node, so it should work with browserify.

You can do either:

var Keys = require('keys.js');

// or

import {Key, Combo, Bindings} from 'keys.js';

Let me know if you are still running into problems!

from keys.js.

jamesfzhang avatar jamesfzhang commented on August 26, 2024

@bitwalker I still can't seem to require it via browserify-rails. I suspect it might be related to the . in the library name? If I move the src file from node_modules into my assets pipeline, I can require it relatively. That'll do for now, thanks!

from keys.js.

bitwalker avatar bitwalker commented on August 26, 2024

Hmm, I wouldn't think so as there are quite a few libs with the something.js naming scheme, perhaps I'm missing something else. I'll try and find some time to play with it in browserify.

from keys.js.

bitwalker avatar bitwalker commented on August 26, 2024

@jamesfzhang I found the problem, I needed to add main to my package.json file. Just did a quick test and it appears to be working properly now. Let me know if you are still having trouble (published a new version 1.0.2 btw).

from keys.js.

jamesfzhang avatar jamesfzhang commented on August 26, 2024

@bitwalker Works perfectly now, thanks a lot! Cheers.

from keys.js.

Related Issues (6)

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.