diff --git a/Gruntfile.js b/Gruntfile.js index b60129d..801936a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -144,6 +144,19 @@ module.exports = function(grunt) { }); + // Version assets + grunt.registerTask('version-assets', 'version the static assets just created', function() { + + var Version = require("node-version-assets"); + var versionInstance = new Version({ + assets: ['assets/stylesheets/styles.css', 'assets/javascripts/build.js'], + grepFiles: ['index.html'] + }); + + var cb = this.async(); // grunt async callback + versionInstance.run(cb); + }); + // Load Tasks grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-handlebars'); @@ -155,7 +168,7 @@ module.exports = function(grunt) { // Define tasks grunt.registerTask('test', ['jshint', 'handlebars', 'mocha']); grunt.registerTask('styles', ['less']); - grunt.registerTask('build', ['test', 'requirejs', 'styles']); + grunt.registerTask('build', ['test', 'requirejs', 'styles', 'version-assets']); grunt.registerTask('default', 'build'); }; \ No newline at end of file diff --git a/assets/javascripts/build.js b/assets/javascripts/build.006b52018d561f45ce8ec85d314e9cfa.js similarity index 100% rename from assets/javascripts/build.js rename to assets/javascripts/build.006b52018d561f45ce8ec85d314e9cfa.js diff --git a/assets/stylesheets/styles.css b/assets/stylesheets/styles.63138619ff9a4479affc273c23fb59da.css similarity index 100% rename from assets/stylesheets/styles.css rename to assets/stylesheets/styles.63138619ff9a4479affc273c23fb59da.css diff --git a/changelog.md b/changelog.md index 627b592..14da973 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Recent changes +## 0.2.4 1st Mar 2013 + +* Add [node-version-assets](https://github.com/techjacker/node-version-assets) for cache busting + ## 0.2.3 26th Feb 2013 * Add less compile step diff --git a/index.html b/index.html index cd0af8a..e0aec2f 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ - + @@ -34,6 +34,6 @@ - + \ No newline at end of file diff --git a/package.json b/package.json index 9ce0ef1..015e9f1 100644 --- a/package.json +++ b/package.json @@ -13,5 +13,8 @@ "grunt-contrib-watch": "0.2.0rc7", "grunt-mocha": "~0.2.1", "grunt-contrib-less": "~0.5.0" + }, + "dependencies": { + "node-version-assets": "0.0.6" } -} \ No newline at end of file +} diff --git a/readme.md b/readme.md index c4dc972..769ed33 100644 --- a/readme.md +++ b/readme.md @@ -1,11 +1,12 @@ -# Backbone Stack (0.2.3) +# Backbone Stack (0.2.4) A pre-configured Backbone Stack for starting new projects, it alleviates a lot of the common boilerplate code and setup. It uses AMD modules, mocha for TDD and handlebars precompiled templates. Grunt plays a major role in automated linting, testing and building your code. [![Build Status](https://travis-ci.org/phawk/Backbone-Stack.png?branch=master)](https://travis-ci.org/phawk/Backbone-Stack) -### Latest changes (26th Feb 2013) +### Latest changes (1st Mar 2013) +* Add [node-version-assets](https://github.com/techjacker/node-version-assets) for cache busting * Add less compile step * Add boostrap from bower @@ -89,7 +90,7 @@ $ grunt test ## Building your code -All of the JavaScript is pre-build using [grunt](http://gruntjs.com/) and the r.js optimiser, this means your development environment better simulates what will be served in production. +All of the JavaScript is pre-build using [grunt](http://gruntjs.com/) and the r.js optimiser, this means your development environment better simulates what will be served in production. Your built CSS and JS are then version and your index.html file is automatically updated with the versioned filename. ```sh # Watch src/ and test/ files and test, then build on change