grunt-contrib-clean插件-tasks目录下clean.js文件中配置了一个clean任务:
所以在Gruntfile.js中配置任务的时候很简单:
这样执行 grunt clean:dist 命令时就可以成功删除 a.b.c 目录下的文件。
[url]https://www.npmjs.com/package/grunt-contrib-clean[/url]
grunt.registerMultiTask('clean', 'Clean files and folders.', function() {
// Merge task-specific and/or target-specific options with these defaults.
var options = this.options({
force: grunt.option('force') === true,
'no-write': grunt.option('no-write') === true,
});
grunt.verbose.writeflags(options, 'Options');
// Clean specified files / dirs.
this.filesSrc.forEach(function(filepath) {
clean(filepath, options);
});
});
所以在Gruntfile.js中配置任务的时候很简单:
grunt.initConfig({
clean : {
dist : ['/a','/b','/c'],
server : 'a'
}
}),
这样执行 grunt clean:dist 命令时就可以成功删除 a.b.c 目录下的文件。
[url]https://www.npmjs.com/package/grunt-contrib-clean[/url]