selanac82
selanac82

Reputation: 3000

Fire function when Grunt task is completed

I have a grunt multitask registerd and i'm trying to fire a function once a task has ended. I'm using grunt.task.run. Here is the code.

grunt.task.run(["clean", "sass:prod", "cssmin", "concat", "uglify", "copy:dev"]);

I want to run a function once the copy:dev task is completed. Any ideas?

Upvotes: 0

Views: 79

Answers (1)

Ben
Ben

Reputation: 10146

Simple enough; register a task to be run at the end with your custom code.

module.exports = function(grunt) {
    'use strict';
    grunt.registerTask('myTask', 'it does things', function(){
        // do things
    });
    grunt.task.run(["clean", "sass:prod", "cssmin", "concat", "uglify", "copy:dev", "myTask"])
};

Upvotes: 1

Related Questions