I have a project where I'm using grunt
to process my Js
and SASS
files.
At the moment, when I need to process something, I need to call all the tasks inside my gruntfile.js
even if I want to change only one module, or only the SASS
file.
Is there a way to create a custom task, to run only the sass part, and another one to create only a module process, where I can call this task from the prompt?
This is what I tried, without success:
module.exports = function(gruntHome) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/* @CONCAT */
concat: {
home : {
src: 'src/app/component/home/*.js',
dest: 'src/app/component/home/concat/concat_config.js'
}
},
/* @ANNOTATE */
ngAnnotate: {
options: {
add: true
},
home: {
files: {
'src/app/component/home/concat/concat_config.js': 'src/app/component/home/concat/concat_config.js'
}
}
},
/* @UGLIFY */
uglify: {
home: {
src: 'src/app/component/home/concat/concat_config.js',
dest: 'app/component/home/home.min.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.registerTask('gruntTask', ['concat', 'ngAnnotate', 'uglify']);
};
If it's not possible, is there any other way to achieve this objective? Because my gruntfile.js is huge, and sometimes it takes a lot of time to process, even if I don't need to process everything.
Edit:
This link here is a related question I made following the steps provided on this question. It will solve some possible issues you have when trying to do what i did here. Hope it can help other people.