From 3422063ac3c614bec443aa97466cd8121d8ef23c Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Fri, 3 Jun 2016 00:49:45 +0200 Subject: [PATCH] [TASK] Development sourcemap and release clean - Add app.js sourcemap for development - Remove css sourcemap in release - Clean build folder for release --- Gruntfile.js | 4 ++-- tasks/build.js | 13 +++++++++++-- tasks/clean.js | 3 ++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 28e26fb..3de4a63 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,7 +3,7 @@ module.exports = function (grunt) { grunt.loadTasks("tasks"); - grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass", "postcss", "requirejs:default", "inlinedata", "cachebreaker", "inline"]); + grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass:dist", "postcss", "requirejs:default", "inlinedata", "cachebreaker", "inline", "clean:release"]); grunt.registerTask("lint", ["sasslint", "eslint"]); - grunt.registerTask("serve", ["bower-install-simple", "lint", "copy", "sass", "requirejs:dev", "inlinedata", "browserSync", "watch"]); + grunt.registerTask("serve", ["bower-install-simple", "lint", "copy", "sass:dev", "requirejs:dev", "inlinedata", "browserSync", "watch"]); }; diff --git a/tasks/build.js b/tasks/build.js index f4d124b..d56471a 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -48,11 +48,19 @@ module.exports = function (grunt) { } }, sass: { + dev: { options: { sourceMap: true, - outputStyle: "compressed" + outputStyle: "expanded" + }, + files: { + "build/style.css": "scss/main.scss" + } }, dist: { + options: { + outputStyle: "compressed" + }, files: { "build/style.css": "scss/main.scss" } @@ -121,7 +129,8 @@ module.exports = function (grunt) { include: "../app", optimize: "none", out: "build/app.js", - build: false + build: false, + generateSourceMaps: true } } }, diff --git a/tasks/clean.js b/tasks/clean.js index 67181e0..35d30a3 100644 --- a/tasks/clean.js +++ b/tasks/clean.js @@ -3,7 +3,8 @@ module.exports = function (grunt) { grunt.config.merge({ clean: { - build: ["build/**/*", "node_modules/grunt-newer/.cache"] + build: ["build/**/*", "node_modules/grunt-newer/.cache"], + release: ["build/vendor", "build/app.js.map", "build/config.json", "build/style.css*"] } });