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

Compiled coffeescripts loading order in debug mode #17

Open
wuciawe opened this issue Jul 17, 2015 · 2 comments
Open

Compiled coffeescripts loading order in debug mode #17

wuciawe opened this issue Jul 17, 2015 · 2 comments

Comments

@wuciawe
Copy link

wuciawe commented Jul 17, 2015

It seems that in the debug mode the loading order of the compiled coffeescripts are not specified and may cause error. In my case, the app.js is loaded after other javascript files which causes undefined module errors.

@lalanikarim
Copy link

@wuciawe Change the last few lines of index.scala.html as below. It will ensure app.js is loaded prior to other javascript files.

<!-- Coffee script compiled resources (generated) -->
<script src='@routes.Assets.versioned("javascripts/app.js")' type="text/javascript"></script>

@for(script <- javascripts) {
    @if(!script.endsWith("app.js")){
        <script src='@routes.Assets.versioned(script)' type="text/javascript"></script>
    }
}

@wuciawe
Copy link
Author

wuciawe commented Aug 25, 2015

@jimmy00784 This should work in debug mode, but I remember that in the product mode all of those scripts will be compiled into one script file (through uglify, digest, and gzip). Although we can modify the index.scala further to make correct includings which is what I do now, it looks not so neat. Does there exist better solution? Is require.js suitable in this situation? If so, would you give me a simple demo? (I am new to uglify, digest, gzip, requirejs, thank you so much for your reply.)

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