Title here
Summary here
_devΒ and _package to add new tasks_dev is executed onΒ grunt serve_package is executed onΒ grunt packageDo not add task based on fixed index, find the index of the task just before.
WRONG :
grunt.registerTask("_dev", function () {
// Get tasks
let tasks = this.options().tasks;
tasks.splice(12, 0, 'copy:lightningjs');
// Run tasks
grunt.task.run(tasks);
});GOOD :
grunt.registerTask("_dev", function () {
// Get tasks
let tasks = this.options().tasks;
tasks.splice(tasks.indexOf('bundle'), 0, 'copy:lightningjs');
// Run tasks
grunt.task.run(tasks);
});Do not add task based on profile naming but based on profile flags.
WRONG :
grunt.registerTask("_dev", function () {
// Get tasks
var tasks = this.options().tasks;
let profile = grunt.file.readJSON(grunt.config("resolveConfig.options.resolvedConfigFilePath"));
if (profile.includes("lightning") {
tasks.splice(tasks.indexOf('bundle'), 0, 'copy:lightningjs');
}
// Run tasks
grunt.task.run(tasks);
});GOOD :
grunt.registerTask("_dev", function () {
// Get tasks
var tasks = this.options().tasks;
let profile = grunt.file.readJSON(grunt.config("resolveConfig.options.resolvedConfigFilePath"));
if (profile.isLightning) {
tasks.splice(tasks.indexOf('bundle'), 0, 'copy:lightningjs');
}
// Run tasks
grunt.task.run(tasks);
});