我正在为一个项目使用yeoman。
基本上它工作得很好,但在构建过程中,我想将图像文件夹移动到其他地方。
所以我加载了grunt-contrib-copy任务,它可以让我做到这一点。但不幸的是,这与yeoman内置的复制任务相冲突。
有没有办法在我的Gruntfile.js中给grunt-contrib-copy加上别名,这样我就可以同时使用它们了?
grunt.loadNpmTasks('grunt-contrib-copy');
//Here I need to use "copy" again but not referencing the yeoman task but the grunt-contrib-copy task.
grunt.registerTask('build','intro clean coffee compass mkdirs concat css min replace copy time');发布于 2012-12-14 22:31:29
在这方面,grunt.renameTask()可能会对您有所帮助。试试这个:
// temporarily rename yeoman's copy task
grunt.renameTask('copy', 'yeomanCopy');
// load 'copy' from grunt-contrib-copy
grunt.loadNpmTasks('grunt-contrib-copy');
// rename it to something other than 'copy'
grunt.renameTask('copy', 'myCopy');
// rename yeoman's task back to its original name so nothing breaks
grunt.renameTask('yeomanCopy', 'copy');
// now use 'myCopy' for your purposes
// ...https://stackoverflow.com/questions/13878429
复制相似问题