我已经安装了grunt任务grunt-contrib-copy
。我将它嵌入到我的Gruntfile.js
中,并通过grunt.loadNpmTasks('grunt-contrib-copy');
加载任务。配置grunt复制任务以排除文件/文件夹
目前我使用下面的配置来创建一个文件夹与我的js文件/文件夹的子集。
copy: {
options: {
processContent: [],
processContentExclude: ['build/**', 'bin/**', '.*', '*.orig', '*.bak', '.*/**', '*.log', 'dist/**', 'test/**', 'dev/**', 'pyserver/**', 'node_modules/**', 'doc/**']
},
du: {
files: [
{src: ['.conf1', '.conf2', './config.js'], dest: 'output/toolkit/', filter: 'isFile'},
{src: ['./css/**/*', './img/**/*', './js/**/*', './release/**/*', './lib/**/*', './locale/**/*'], dest: 'output/toolkit/'},
{expand: true, cwd: './', src: ['**'], dest: 'output/'}
]
}
}
这工作得很好,但每次我运行咕噜复制,出现以下错误消息退出:
Copying Gruntfile.js -> output/Gruntfile.js
Warning: Error while processing "Gruntfile.js" file. Use --force to continue.
我想排除js/**/*
Gruntfile.js
和所有*.less
文件。尝试与!(.less), !.less, !(*.less), !(./Grunfile.js), !(*Gruntfile.js)
...但没有任何作品。将它添加到processContentExclude
阵列中,但没有成功。
那么如何排除文件夹结构js/**/*
中的Gruntfile.js
和全部文件?
要省略目录,使用'!workingdir /省略/ **' – Ben 2014-05-21 18:31:01