I’m writing a backbone.js app. I have multiple js, css and html template files. I also have a script to crunch them into a single file so it is faster to download. How should I work during development:
-
Add a listener to the file system and after every change compile the files so I can see it in a browser. This implies a 1-2 seconds overhead before I can see what I did, which is annoying for html fine-tuning.
-
Somehow browse using the multiple files during development and only crunch before going to production. This means I need to have a separate index.html for dev and prod.
What’s your take?
I use Minify to combine and minify my JS, and in my index.html for my backbone apps, I simply have a code block like this:
Then, in my groupsConfig in my Minify’s
/min/directory, I define my build array to match jQuery’s deferred object load order:It’s probably not as DRY as it could be but it works and you can tweak it for your needs.