modern-web-template
modern-web-template copied to clipboard
Compiled coffeescripts loading order in debug mode
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.
@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>
}
}
@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.)