grunt: deduplicate jobs

pull/1/head
5chdn 6 years ago
parent 9650f8eb85
commit 731091c675
No known key found for this signature in database
GPG Key ID: 1A40871B597F5F80
  1. 52
      Gruntfile.js

@ -48,11 +48,8 @@ module.exports = function(grunt) {
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
clean: { clean: {
build: ['dist'], build: ['dist'],
cleanup_js: ['dist/js/*.*', '!dist/js/netstats.*'], js: ['dist/js/*.*', '!dist/js/netstats.*'],
cleanup_css: ['dist/css/*.css', '!dist/css/netstats.*.css'], 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']
}, },
jade: { jade: {
build: { build: {
@ -84,7 +81,7 @@ module.exports = function(grunt) {
{ {
expand: true, expand: true,
cwd: 'src/fonts/', cwd: 'src/fonts/',
src: ['minimal-*.*'], src: ['*.*'],
dest: 'dist/fonts/', dest: 'dist/fonts/',
filter: 'isFile' filter: 'isFile'
}, },
@ -150,14 +147,6 @@ module.exports = function(grunt) {
src: ['*.css', '!*.min.css'], src: ['*.css', '!*.min.css'],
dest: 'dist/css/' dest: 'dist/css/'
}] }]
},
build_pow: {
files: [{
expand: true,
cwd: 'dist/css',
src: ['*.css', '!*.min.css'],
dest: 'dist/css/'
}]
} }
}, },
concat: { concat: {
@ -191,35 +180,15 @@ module.exports = function(grunt) {
src: ['dist/css/*.min.css', 'dist/css/*.css'], src: ['dist/css/*.min.css', 'dist/css/*.css'],
dest: 'dist/css/netstats.min.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: { netstats_pow: {
options: { options: {
sourceMap: false, sourceMap: false,
sourceMapIncludeSources: true, sourceMapIncludeSources: true,
sourceMapIn: ['dist/js/vendor.min.js.map', 'dist/js/app.min.js.map'] 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', dest: 'dist/js/netstats.min.js',
nonull: true, nonull: true,
},
css_pow: {
src: ['dist/css/*.min.css', 'dist/css/*.css'],
dest: 'dist/css/netstats.min.css'
} }
}, },
uglify: { uglify: {
@ -231,15 +200,6 @@ module.exports = function(grunt) {
}, },
dest: 'dist/js/app.min.js', dest: 'dist/js/app.min.js',
src: ['<%= concat.scripts.dest %>'] 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-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify'); 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('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_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('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'); grunt.registerTask('poa', 'default');
}; };

Loading…
Cancel
Save