【发布时间】:2016-02-03 00:24:53
【问题描述】:
var pathValue="";
module.exports = function(grunt) {
grunt.initConfig({
copy: {
main: {
files: [{
cwd: 'srcpath', // set working folder / root to copy
src: '**/*', // copy all files and subfolders
dest: 'pathValue', // destination folder
expand: true
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('copy', function(n) {
var target = grunt.option('target');
pathValue = target;
// do something useful with target here
});
};
我正在尝试从命令行将目标路径传递给复制任务。我厌倦了命令
grunt 复制 --target=destpath
它显示“完成且没有错误”,但未在目标目录中创建新文件夹。谁能告诉我代码中的错误是什么?
【问题讨论】:
标签: gruntjs grunt-contrib-copy