From 731091c67531359d4729c283a7bb2c2a1c1ab404 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Mon, 3 Dec 2018 13:38:41 +0100 Subject: [PATCH] grunt: deduplicate jobs --- Gruntfile.js | 52 ++++++---------------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 7649bc0..83d2b4d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -48,11 +48,8 @@ module.exports = function(grunt) { pkg: grunt.file.readJSON('package.json'), clean: { build: ['dist'], - cleanup_js: ['dist/js/*.*', '!dist/js/netstats.*'], - cleanup_css: ['dist/css/*.css', '!dist/css/netstats.*.css'], - build_pow: ['dist'], - cleanup_js_pow: ['dist/js/*.*', '!dist/js/netstats.*'], - cleanup_css_pow: ['dist/css/*.css', '!dist/css/netstats.*.css'] + js: ['dist/js/*.*', '!dist/js/netstats.*'], + css: ['dist/css/*.css', '!dist/css/netstats.*.css'] }, jade: { build: { @@ -84,7 +81,7 @@ module.exports = function(grunt) { { expand: true, cwd: 'src/fonts/', - src: ['minimal-*.*'], + src: ['*.*'], dest: 'dist/fonts/', filter: 'isFile' }, @@ -150,14 +147,6 @@ module.exports = function(grunt) { src: ['*.css', '!*.min.css'], dest: 'dist/css/' }] - }, - build_pow: { - files: [{ - expand: true, - cwd: 'dist/css', - src: ['*.css', '!*.min.css'], - dest: 'dist/css/' - }] } }, concat: { @@ -191,35 +180,15 @@ module.exports = function(grunt) { src: ['dist/css/*.min.css', 'dist/css/*.css'], dest: 'dist/css/netstats.min.css' }, - vendor: { - options: { - sourceMap: false, - sourceMapIncludeSources: true, - sourceMapIn: ['dist/js/lib/*.map'] - }, - src: vendor, - dest: 'dist/js/vendor.min.js' - }, - scripts : { - options: { - separator: ';\n', - }, - src: scripts, - dest: 'dist/js/app.js' - }, netstats_pow: { options: { sourceMap: false, sourceMapIncludeSources: true, sourceMapIn: ['dist/js/vendor.min.js.map', 'dist/js/app.min.js.map'] }, - src: ['<%= concat.vendor.dest %>', '<%= uglify.app_pow.dest %>'], + src: ['<%= concat.vendor.dest %>', '<%= uglify.app.dest %>'], dest: 'dist/js/netstats.min.js', nonull: true, - }, - css_pow: { - src: ['dist/css/*.min.css', 'dist/css/*.css'], - dest: 'dist/css/netstats.min.css' } }, uglify: { @@ -231,15 +200,6 @@ module.exports = function(grunt) { }, dest: 'dist/js/app.min.js', src: ['<%= concat.scripts.dest %>'] - }, - app_pow: { - options: { - mangle: false, - sourceMap: false, - sourceMapIncludeSources: true - }, - dest: 'dist/js/app.min.js', - src: ['<%= concat.scripts.dest %>'] } } }); @@ -251,7 +211,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.registerTask('default', ['clean:build', 'clean:cleanup_js', 'clean:cleanup_css', 'jade:build', 'copy:build', 'cssmin:build', 'concat:vendor', 'concat:scripts', 'uglify:app', 'concat:netstats', 'concat:css', 'clean:cleanup_js', 'clean:cleanup_css']); - grunt.registerTask('pow', ['clean:build_pow', 'clean:cleanup_js_pow', 'clean:cleanup_css_pow', 'jade:build_pow', 'copy:build_pow', 'cssmin:build_pow', 'concat:vendor', 'concat:scripts', 'uglify:app_pow', 'concat:netstats_pow', 'concat:css_pow', 'clean:cleanup_js_pow', 'clean:cleanup_css_pow']); + grunt.registerTask('default', ['clean:build', 'clean:js', 'clean:css', 'jade:build', 'copy:build', 'cssmin:build', 'concat:vendor', 'concat:scripts', 'uglify:app', 'concat:netstats', 'concat:css', 'clean:js', 'clean:css']); + grunt.registerTask('pow', ['clean:build', 'clean:js', 'clean:css', 'jade:build_pow', 'copy:build_pow', 'cssmin:build', 'concat:vendor', 'concat:scripts', 'uglify:app', 'concat:netstats_pow', 'concat:css', 'clean:js', 'clean:css']); grunt.registerTask('poa', 'default'); };