1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-30 05:31:56 +02:00

assets versioning during grunt build, closes #10

This commit is contained in:
Matthias Kretschmann 2013-12-11 21:36:43 +01:00
parent 67efcc04e6
commit ccbd65fda5
2 changed files with 31 additions and 8 deletions

View File

@ -9,7 +9,8 @@ module.exports = function(grunt){
less: 'assets/less', less: 'assets/less',
css: 'assets/css', css: 'assets/css',
js: 'assets/js', 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 stuff around
rsync: { rsync: {
options: { options: {
@ -227,8 +247,8 @@ module.exports = function(grunt){
// Full Dev server // Full Dev server
grunt.registerTask('server', [ grunt.registerTask('server', [
'rsync:copy_media',
'jekyll:development', 'jekyll:development',
'rsync:copy_media',
'less', 'less',
'cmq', 'cmq',
'cssmin', 'cssmin',
@ -250,14 +270,15 @@ module.exports = function(grunt){
// Production build // Production build
grunt.registerTask('build', [ grunt.registerTask('build', [
'clean', 'clean',
'rsync:copy_media',
'jekyll:production', 'jekyll:production',
'imagemin:assets', 'rsync:copy_media',
'imagemin:touchicons',
'less', 'less',
'cmq', 'cmq',
'cssmin', 'cssmin',
'uglify' 'uglify',
'rev',
'usemin',
'imagemin'
]); ]);
// Deploy // Deploy

View File

@ -10,13 +10,15 @@
"grunt-contrib-clean": "~0.5.0", "grunt-contrib-clean": "~0.5.0",
"grunt-contrib-connect": "~0.5.0", "grunt-contrib-connect": "~0.5.0",
"grunt-contrib-cssmin": "~0.6.2", "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-imagemin": "~0.4.0",
"grunt-contrib-uglify": "~0.2.2", "grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-watch": "~0.5.3", "grunt-contrib-watch": "~0.5.3",
"grunt-combine-media-queries": "~1.0.8", "grunt-combine-media-queries": "~1.0.8",
"grunt-jekyll": "~0.4.0", "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": { "repository": {
"type": "git", "type": "git",