Im using yeoman for a project.
Basically it's working fine, but during the build process I want to move my images folder to somewhere else.
So I loaded the grunt-contrib-copy
task which would let me do that. But unfortunately this conflicts with the yeoman built-in copy task.
Is there any way to alias the grunt-contrib-copy
in my Gruntfile.js
so I can use both of them?
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');
Tasks are grunt's bread and butter. The stuff you do most often, like jshint or nodeunit . Every time Grunt is run, you specify one or more tasks to run, which tells Grunt what you'd like it to do. If you don't specify a task, but a task named "default" has been defined, that task will run (unsurprisingly) by default.
Grunt is a JavaScript task runner, a tool used to automatically perform frequent tasks such as minification, compilation, unit testing, and linting. It uses a command-line interface to run custom tasks defined in a file (known as a Gruntfile). Grunt was created by Ben Alman and is written in Node. js.
grunt.task.existsCheck with the name, if a task exists in the registered tasks.
grunt-este-watchby Daniel SteigerwaldRun predefined tasks whenever watched file changes.
grunt.renameTask() will probably help you here. Try this:
// 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
// ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With