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

Single file / require #12

Open
kikito opened this issue Oct 26, 2012 · 1 comment
Open

Single file / require #12

kikito opened this issue Oct 26, 2012 · 1 comment

Comments

@kikito
Copy link

kikito commented Oct 26, 2012

Hi,

I think requiring the files like this just doesn't cut it:

<script type="text/javascript" src="../js/lua-parser.js"        ></script>
<script type="text/javascript" src="../js/lua-parser-utils.js"  ></script>
<script type="text/javascript" src="../js/gamepad.js"      ></script>
<script type="text/javascript" src="../js/jquery.js"      ></script>
<script type="text/javascript" src="../js/jquery.hotkeys.js"      ></script>
<script type="text/javascript" src="../js/utils.js"         ></script>
<script type="text/javascript" src="../js/utils.webgl.js"       ></script>
<script type="text/javascript" src="../js/love.render.js"       ></script>
<script type="text/javascript" src="../js/main.js"          ></script>
...

I see two options:

  • Using a tool like Uglify to bundle all the js files into a single one (maybe as part of a "push" task, so it is done automatically every time you push new stuff to github)
  • Including a lib like requirejs so that a single file (love.js) can use it to require all the files it needs.
@josefnpat
Copy link

If you're ok with moving away from a pure JS implementation by using some php, you can check out the index.php I commited a long while back;

https://github.com/ghoulsblade/love-webplayer/blob/master/index.php

You'll notice it builds this section automatically,

Although I personally thing an auto-detecting JS would be a lot better.

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