M
M
Mike Diam2016-04-04 16:29:11
Grunt.js
Mike Diam, 2016-04-04 16:29:11

How to configure the execution of grunt plugins for different tasks in different ways?

Grunt is used locally and on the server. It executes the tasks locally:
grunt.registerTask('default', ['concat', 'uglify', 'cssmin', 'htmlmin', 'watch']);
On the server, it does:
grunt.registerTask('deploy', ['concat', 'uglify', 'cssmin, 'htmlmin']);
The problem is that the settings of these plugins specify the destination folder for the files after processing - /dest, but I need to change the file destinations when executing the deploy task.
How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2016-04-04
@mikediam

Create subtasks with common settings, but in different ways.

grunt.registerTask('default', ['concat:dev', 'uglify:dev', 'cssmin:dev', 'htmlmin:dev', 'watch:dev']);
grunt.registerTask('deploy', ['concat:prod', 'uglify:prod', 'cssmin:prod', 'htmlmin:prod']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question