我正在使用grunt-contrib-copy将文件夹和文件从我的src文件夹复制到build文件夹。但是我想从我的src目录的app子目录中排除所有的.js文件。这是我的Gruntfile。但它是从应用程序目录的子目录中复制所有.js文件,而不是将其排除。我应该做些什么改变才能使它工作。
这是我的grunt文件:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Task configuration.
concat: {
dist: {
src: ['src/app/**/*.js'],
dest: 'build/app.min.js'
}
},
copy: {
main: {
files: [
//includes files within path and its sub-directories
//{src: ['src/**', '!/src/app/**/*.js'], dest: 'build/', filter: 'isFile'}
{expand: true, src: ['src/**', '!/src/app/**/*.js'], dest: 'build/', filter: 'isFile'}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['concat', 'copy']);
};参考:Configure grunt copy task to exclude files/folders
谢谢。
发布于 2014-04-24 22:13:22
你能试着去掉感叹号后面的第一个斜杠吗?因此,请更改以下内容:
'!/src/app/**/*.js'要这样做:
'!src/app/**/*.js'https://stackoverflow.com/questions/23192854
复制相似问题