mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-49817 grunt: add watch task
This allows files to be watched and automatically build when changed. Thanks to David Monllaó for the initial basis for this patch.
This commit is contained in:
parent
5cc5f31101
commit
8efbb7b1a1
24
Gruntfile.js
24
Gruntfile.js
@ -74,6 +74,23 @@ module.exports = function(grunt) {
|
||||
compress: true
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
options: {
|
||||
nospawn: true // We need not to spawn so config can be changed dynamically.
|
||||
},
|
||||
amd: {
|
||||
files: ['**/amd/src/**/*.js'],
|
||||
tasks: ['amd']
|
||||
},
|
||||
bootstrapbase: {
|
||||
files: ["theme/bootstrapbase/less/**/*.less"],
|
||||
tasks: ["less:bootstrapbase"]
|
||||
},
|
||||
yui: {
|
||||
files: ['**/yui/src/**/*.js'],
|
||||
tasks: ['shifter']
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
@ -245,10 +262,17 @@ module.exports = function(grunt) {
|
||||
};
|
||||
|
||||
|
||||
// On watch, we dynamically modify config to build only affected files.
|
||||
grunt.event.on('watch', function(action, filepath) {
|
||||
grunt.config('jshint.amd.src', filepath);
|
||||
grunt.config('uglify.amd.files', [{ expand: true, src: filepath, rename: uglify_rename }]);
|
||||
});
|
||||
|
||||
// Register NPM tasks.
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-less');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
|
||||
// Register JS tasks.
|
||||
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
|
||||
|
3612
npm-shrinkwrap.json
generated
3612
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,7 @@
|
||||
"grunt-contrib-jshint": "0.11.3",
|
||||
"grunt-contrib-less": "1.1.0",
|
||||
"grunt-contrib-uglify": "0.11.0",
|
||||
"grunt-contrib-watch": "0.6.1",
|
||||
"shifter": "0.5.0"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user