When using the yeoman backbone generator, I am not clear on how the grunt tasks work.
grunt server
run the application from? It appears to run from the .tmp folder.grunt server:dist
run the application from? It appears to run from the dist folder, but in my case the app does not launch correctly. It is trying to require
HomePage.js which is not found.grunt server:test
run from? It runs "watch:livereload" and then does not launch a browser.When you use grunt server
, you run your application from app/ dir. app/ is where your pure, non-compiled, non-minified source code lives. You don't need to change anything inside the .tmp/
When you use grunt server:dist
, you build your application from app/ to dist/ and run it from dist/. dist/ is your distributable application.
If you have a js error with grunt server:dist
and not grunt server
make sure you put your js link between
<!-- build:js({.tmp,app}) scripts/main.js -->
<script src="scripts/main.js"></script>
<script src="scripts/templates.js"></script>
<script src="scripts/HomePage.js"></script>
<!-- endbuild -->
Because the build process will concat all these files and build a new one (scripts/main.js) without copy the content of app/scripts into dist/scripts.
grunt server:test
run from app and basically does enough to create and serve your application for your test framework, Mocha, to execute your tests. That don't launch a browser because it only serve your application for your test framework.
Source: http://net.tutsplus.com/tutorials/javascript-ajax/building-apps-with-the-yeoman-workflow/