-
Notifications
You must be signed in to change notification settings - Fork 19
Error when running watch with assets-versioning #62
Description
I have the following grunt configuration:
grunt.initConfig({
less: {
dev: {
files:[ {
expand: true,
cwd: 'static/less/',
src: ['*/master/**/*.less', '*/views/**/*.less'],
ext: '.css',
dest: 'static/csscache/'
}]
}
},
assets_versioning: {
options: {
tag: 'hash',
hashLength: 32
},
css: {
options: {
post: true,
//versionsMapTrimPath: "static/csscache/",
versionsMapFile : 'staticmap.json',
versionsMapTemplate: 'json.tpl',
tasks: ['less:dev']
}
}
},
watch:{
less:{
files: "static/less/**/*.less",
tasks: ['assets_versioning'],
options: {
nospawn: true
}
}
}
});
When I run "grunt watch" and touches one of the less files, all less files get recompiled and versioned.
However, when I touch one of the less files a second time, I get the following and nothing gets versioned:
"
Running "assets_versioning:css" (assets_versioning) task
Versioning files from less:dev task.
Versioning files from assets_versioning:css task.
Warning: Task 'assets_versioning:css_post_assets_versioning' already exists!
"
Looking at "tasks\helpers\task.js", it seems that when a grunt.config key already exists, it fails in purpose:
Task.prototype.createSurrogate = function (filesObj) {
...
if (grunt.config(surrogateTaskConfigKey)) {
grunt.fail.warn("Task '" + surrogateTask + "' already exists!");
}
...
};
Task.prototype.createPostVersioningTask = function (filesObj) {
...
if (grunt.config(taskConfigKey)) {
grunt.fail.warn("Task '" + postTask + "' already exists!");
}
...
};
Any reason it's done this way?