ngbp / ngbp

A sophisticated build management system for web apps (formerly ng-boilerplate). Created by @joshdmiller
http://bit.ly/ngBoilerplate
MIT License
3.92k stars 1.04k forks source link

Use grunt-rev to avoid caching of css and js files #167

Open alex6o opened 11 years ago

alex6o commented 11 years ago

hi! at first thx for the great work ;) i have seen that ngboilerplate uses version number as prefix for compiled js and css files, but is it possible to add an plugin like https://github.com/cbas/grunt-rev to generate a hash prefix that is based on the filecontent? this could automatically prevent browsers from using a cached version of the script.

joshdmiller commented 11 years ago

Thanks - I'm glad you're finding it useful. :-)

The reason we added the version number was to prevent browser caching; the idea is that if you change your app, the version number should change and therefore so will the file names - I'm a fan of semantic versioning. I'm not opposed to using something like grunt-rev, but I would need a compelling reason to do that over just the version numbers. Is there a reason why the version numbers would not be used?

alex6o commented 11 years ago

Ah josh I am sorry i have not seen that nice bump plugin that allows us to increment the version number over the console. The only reason for me to use grunt-rev was that it automatically prefixes the files without any further commands. On the other side, during devlopment the hash approach could be very useful to prevent issues produced by caching.

joshdmiller commented 11 years ago

@mrmuh As I said, I am not opposed to this if there is a good use case. If serving files over file:// during development, there is no caching. Are you running into a caching problem in your development process right now?