diff --git a/Gruntfile.js b/Gruntfile.js index c32380de..2e7f73d0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,7 +9,8 @@ module.exports = function(grunt){ less: 'assets/less', css: 'assets/css', js: 'assets/js', - img: 'assets/img' + img: 'assets/img', + fonts: 'assets/fonts' } }; @@ -179,6 +180,25 @@ module.exports = function(grunt){ }, }, + // assets versioning + rev: { + files: { + src: [ + '<%= config.site %>/assets/{css,js,img,fonts}/*.*' + ] + } + }, + + // updating assets paths in html/css + usemin: { + html: ['<%= config.site %>/**/*.html'], + css: ['<%= config.site %>/**/*.css'], + options: { + dirs: ['<%= config.site %>'], + basedir: ['<%= config.site %>'] + } + }, + // rsync stuff around rsync: { options: { @@ -227,8 +247,8 @@ module.exports = function(grunt){ // Full Dev server grunt.registerTask('server', [ - 'rsync:copy_media', 'jekyll:development', + 'rsync:copy_media', 'less', 'cmq', 'cssmin', @@ -250,14 +270,15 @@ module.exports = function(grunt){ // Production build grunt.registerTask('build', [ 'clean', - 'rsync:copy_media', 'jekyll:production', - 'imagemin:assets', - 'imagemin:touchicons', + 'rsync:copy_media', 'less', 'cmq', 'cssmin', - 'uglify' + 'uglify', + 'rev', + 'usemin', + 'imagemin' ]); // Deploy diff --git a/package.json b/package.json index 0d3dd7d1..df17735e 100644 --- a/package.json +++ b/package.json @@ -10,13 +10,15 @@ "grunt-contrib-clean": "~0.5.0", "grunt-contrib-connect": "~0.5.0", "grunt-contrib-cssmin": "~0.6.2", - "grunt-contrib-less": "~0.6.4", + "grunt-contrib-less": "~0.6.4", "grunt-contrib-imagemin": "~0.4.0", "grunt-contrib-uglify": "~0.2.2", "grunt-contrib-watch": "~0.5.3", "grunt-combine-media-queries": "~1.0.8", "grunt-jekyll": "~0.4.0", - "grunt-rsync": "~0.2.1" + "grunt-rsync": "~0.2.1", + "grunt-rev": "~0.1.0", + "grunt-usemin": "~2.0.2" }, "repository": { "type": "git",