我已经安装了 grunt 任务grunt-contrib-copy
。我把它嵌入到我的Gruntfile.js
并通过加载任务grunt.loadNpmTasks('grunt-contrib-copy');
.
目前,我使用以下配置来创建一个包含 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/'}
]
}
}
这工作正常,但每次我运行 grunt copy 时,它都会退出并显示以下错误消息:
Copying Gruntfile.js -> output/Gruntfile.js
Warning: Error while processing "Gruntfile.js" file. Use --force to continue.
我想排除Gruntfile.js
和所有*.less
文件在js/**/*
。尝试过!(.less), !.less, !(*.less), !(./Grunfile.js), !(*Gruntfile.js)
......但没有任何作用。将其添加到processContentExclude
数组,但也没有成功。
那么我怎样才能排除Gruntfile.js
以及文件夹结构中的所有较少文件js/**/*
?