To specify the sequence of tasks to execute when running grunt serve
, you can follow a similar approach to Yeoman. Your final setup might look something like this:
grunt.registerTask('serve', 'initiate server and preview app', [
'clean:dist',
'copy',
'preprocess',
'connect:livereload',
'open',
'watch'
]);
Essentially, you're creating an alias
task using grunt.registerTask
.
By specifying a list of tasks, the new task will act as an alias for one or more existing tasks. When you run this "alias task," all specified tasks in the list will be executed in the defined order.
In simple terms, if you are already utilizing a task such as grunt-serve, you may have a task named serve
, which can be aliased as shown below:
grunt.registerTask('serve', 'initiate server and preview app', [
'clean:dist',
'copy',
'preprocess',
'serve:dist'
]);