npm install grunt-contrib-clean --save-dev
files 是grunt公共属性,src 是需要删除的文件夹
执行gurnt clean 则删除 output 文件夹
module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), clean: { cleanoutput: { files: [{ src: 'output/' }] } } }); grunt.loadNpmTasks('grunt-contrib-clean'); };