我是靠谱客的博主 难过乌龟,这篇文章主要介绍grunt配置-clean任务,现在分享给大家,希望可以做个参考。

grunt-contrib-clean插件-tasks目录下clean.js文件中配置了一个clean任务:


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]

最后

以上就是难过乌龟最近收集整理的关于grunt配置-clean任务的全部内容,更多相关grunt配置-clean任务内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(99)

评论列表共有 0 条评论

立即
投稿
返回
顶部