Module.exports =function(grunt) {//Build a task configurationGrunt.initconfig ({//read the contents of the Package.json to form a JSON dataPkg:grunt.file.readJSON (' Package.json '), //Compression JSuglify: {//file Header Output Informationoptions: {banner:‘/*! <%= pkg.name%> <%= grunt.template.today ("Yyyy-mm-dd")%> */\n '}, My_target: {files: [{expand: true, //relative PathCWD: ' js/', SRC:' *.js ', dest:' Dest/js ' } ] } }, //Compress CSScssmin: {//file Header Output Informationoptions: {banner:‘/*! <%= pkg.name%> <%= grunt.template.today ("Yyyy-mm-dd")%> */\n ', //beautify the CodeBeautify: {//Chinese ASCII, very useful! God configuration to prevent Chinese garbled charactersAscii_only:true}}, My_target: {files: [{ Expand:true, //relative PathCWD: ' css/', SRC:' *.css ', dest:' Dest/css ' } ] } } }); //load the specified plug-in taskGrunt.loadnpmtasks (' grunt-contrib-uglify '); Grunt.loadnpmtasks (' Grunt-contrib-cssmin '); //tasks that are performed by defaultGrunt.registertask (' Default ', [' uglify ', ' cssmin ']);};
Grunt: Multiple css,js for individual compression