Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import CraftyJS to js file #1209

Open
eldarkk opened this issue Apr 10, 2019 · 1 comment
Open

How to import CraftyJS to js file #1209

eldarkk opened this issue Apr 10, 2019 · 1 comment

Comments

@eldarkk
Copy link

eldarkk commented Apr 10, 2019

Hello guys. How can i import crafty js to another js file for using it ?

@starwed
Copy link
Member

starwed commented Apr 20, 2019

There are a few ways to accomplish this right now:

  • If you're targeting the web, you can just use the 'old-school' approach of including a script element pointing to crafty.js before your own file. Crafty will then be available as a global.
  • If (as is increasingly more common) you're wanting to import Crafty as a module, Crafty is available on npm. You can check out this example repo.
  • Crafty itself is currently built using browserify, so if you have very specific needs you can always clone the repository and import the various pieces directly. You can see the root file that defines the "normal" version of crafty here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants