Open numediaweb opened 10 years ago
I think newer is not suitable for compass in this case; I have only one main file "main.scss" that imports the rest of partials.. Which means I need to "compass" it all the time!
I also tested it with Assemble and seems not working either; Assemble uses partials and layouts (the same way SASS uses imports) to compile pages.. when I update a partial, the watch task detects the change but "grunt-newer" ignores to run the assemble command because the layout didn't change.. So not really suitable for Assemble and SASS! (unless I'm missing something!)
:+1:
The documentation mentions an "override" option to check for partials: https://github.com/tschaub/grunt-newer#optionsoverride
Unfortunately implementing that checkForModifiedImports
function is left as a non-trivial exercise for the reader. I'm wondering if there's a reference implementation somewhere.
Just encountered the same problem with Browserify.
@jzaefferer checkForModifiedImports
is a placeholder.
According to the docs, override
function is called with the file that is being considered “older” and can force it to be included anyways.
The default value for this option is the following. It won't affect anything.
function nullOverride(details, include) {
include(false);
}
The simplest non-trivial thing is to include all files for the task no matter what.
grunt.config('newer', {
options: {
override: function (detail, include) {
if (detail.task == 'browserify') {
include(true);
}
else {
include(false);
}
}
}
});
Of course it is the same as not using grunt-newer
for this task at all.
You can include some files in every build but still use grunt-newer
to deal with the rest.
grunt.config('newer', {
options: {
override: function (detail, include) {
if (detail.task == 'browserify') {
if (detail.path.match('^lib/')) {
include(true);
}
else {
include(false);
}
}
else {
include(false);
}
}
}
});
Important thing to remember is that grunt-newer
will fire this function only for those files that are listed in the src
config field for the task.
Has anyone come up with a solution for this? I'm trying to use grunt-newer
in a similar capacity with PostCSS where I have imported partials compiling the parent files by default. I suppose it would be difficult to check which files import the edited partial and then have grunt-newer
check against those parents instead.
Hi there,
I just posted something over here, which might be of interest to you.
@eush77 @grayghostvisuals @joshdrink @jzaefferer
All these work arounds seem to just be doing newers job twice (like checking the mtime). Are the changed files not available to just pass into the override method?
Are we going to enter in 2018 with this feature (bug)? Solution with override
is awful I think. It should be option with true/false
value.
@MonoStas - I think the answer to your question is yes. Unless someone contributes a solution.
(Unintentionally closed after leaving that comment.)
in my Grunt file I have:
When I edit a partial *.scss, the "watch" task detects the changes but the "newer" task thinks nothing has changed so it doesn't run the compass on "main.scss".
I have seen an issue here #35 similar but with less.. is there any fix for sass?