Skip to content

Commit

Permalink
MDL-61460 Grunt: Make startup tasks configurable by tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols authored and abgreeve committed Jul 8, 2021
1 parent 341578b commit 2f2ecda
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .grunt/tasks/gherkinlint.js
Expand Up @@ -85,5 +85,8 @@ module.exports = grunt => {
},
});

// Add the 'gherkinlint' task as a startup task.
grunt.moodleEnv.startupTasks.push('gherkinlint');

return handler;
};
3 changes: 3 additions & 0 deletions .grunt/tasks/javascript.js
Expand Up @@ -126,6 +126,9 @@ module.exports = grunt => {
},
});

// Add the 'js' task as a startup task.
grunt.moodleEnv.startupTasks.push('js');

// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
Expand Down
6 changes: 2 additions & 4 deletions .grunt/tasks/startup.js
Expand Up @@ -34,10 +34,8 @@ module.exports = grunt => {
} else if (grunt.moodleEnv.inAMD) {
grunt.task.run('amd');
} else {
// Run them all!.
grunt.task.run('css');
grunt.task.run('js');
grunt.task.run('gherkinlint');
// Run all of the requested startup tasks.
grunt.moodleEnv.startupTasks.forEach(taskName => grunt.task.run(taskName));
}
};

Expand Down
3 changes: 3 additions & 0 deletions .grunt/tasks/style.js
Expand Up @@ -29,4 +29,7 @@ module.exports = grunt => {

// Load the SASS tasks.
require('./sass')(grunt);

// Add the 'css' task as a startup task.
grunt.moodleEnv.startupTasks.push('css');
};
2 changes: 2 additions & 0 deletions Gruntfile.js
Expand Up @@ -246,6 +246,8 @@ module.exports = function(grunt) {
require(path.resolve(`./.grunt/tasks/${name}.js`))(grunt);
};

// Startup tasks.
grunt.moodleEnv.startupTasks = [];

// Add Moodle task configuration.
addTask('gherkinlint', grunt);
Expand Down

0 comments on commit 2f2ecda

Please sign in to comment.