From eda579fbe11c2ffe5b1145be971e27fec3d36343 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 11 Dec 2013 23:47:20 +0100 Subject: [PATCH] isolate media minification --- .gitignore | 3 ++- Gruntfile.js | 39 +++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 5643c872..413afe55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules bower_components -_site \ No newline at end of file +_site +_build \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 2e7f73d0..03d6b753 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,6 +5,7 @@ module.exports = function(grunt){ var gruntConfig = { src: '_src', site: '_site', + build: '_build', assets: { less: 'assets/less', css: 'assets/css', @@ -30,10 +31,14 @@ module.exports = function(grunt){ // clean everything clean: { - build: [ + site: [ '<%= config.site %>/*', '<%= config.site %>/.htaccess', '!<%= config.site %>/media' + ], + build: [ + '<%= config.build %>/*', + '<%= config.build %>/.htaccess' ] }, @@ -213,11 +218,19 @@ module.exports = function(grunt){ syncDestIgnoreExcl: true } }, + // copy build + copy_build: { + options: { + src: '<%= config.site %>/', + dest: '<%= config.build %>', + syncDest: true + } + }, // deployment deploy: { options: { syncDest: true, - src: '<%= config.site %>/', + src: '<%= config.build %>/', dest: 'domains/kremalicious.com/html', host: 'kremalicious', ssh: true, @@ -235,7 +248,7 @@ module.exports = function(grunt){ grunt.loadNpmTasks(file); }); - // Default Task + // Default Task, assets only grunt.registerTask('default', [ 'less', 'cmq', @@ -247,6 +260,7 @@ module.exports = function(grunt){ // Full Dev server grunt.registerTask('server', [ + 'clean:site', 'jekyll:development', 'rsync:copy_media', 'less', @@ -257,16 +271,6 @@ module.exports = function(grunt){ 'watch' ]); - // Assets only Dev server - grunt.registerTask('server-assets', [ - 'less', - 'cmq', - 'cssmin', - 'uglify', - 'connect', - 'watch' - ]); - // Production build grunt.registerTask('build', [ 'clean', @@ -278,7 +282,14 @@ module.exports = function(grunt){ 'uglify', 'rev', 'usemin', - 'imagemin' + 'imagemin:assets', + 'imagemin:touchicons', + 'rsync:copy_build' + ]); + + // Optimze media + grunt.registerTask('mediamin', [ + 'imagemin:media' ]); // Deploy