17

プロジェクトに yeoman を使用しています。

基本的には正常に動作していますが、ビルドプロセス中に画像フォルダーを別の場所に移動したいと考えています。

grunt-contrib-copyだから私はそれを可能にするタスクをロードしました。残念ながら、これは yeoman 組み込みのコピー タスクと競合します。

両方を使用できるようにgrunt-contrib-copy、エイリアスを作成する方法はありますか?Gruntfile.js

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');
4

1 に答える 1

33

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
// ...
于 2012-12-14T14:31:29.217 に答える