Open mbrammer opened 10 years ago
Can you provide a link to or paste the relevant bits of your config?
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
options: {
sassDir: '<%= pkg.sassAppDir %><%= pkg.theme %>/watchdir',
cssDir: '<%= pkg.cssDir %><%= pkg.theme %>',
raw: 'preferred_syntax = :scss\n',
relativeAssets: true,
imagesDir: '<%= pkg.imgDirPublic %><%= pkg.theme %>/',
httpImagesPath: '<%= pkg.imgDir %><%= pkg.theme %>/',
spriteLoadPath: '<%= pkg.imgDirPublic %><%= pkg.theme %>/sprite-source/',
generatedImagesDir: '<%= pkg.imgDirPublic %><%= pkg.theme %>/sprites/',
httpGeneratedImagesPath: '<%= pkg.imgPath %><%= pkg.theme %>/sprites/'
},
production: {
outputStyle: 'compressed'
},
development: {
outputStyle: 'expanded'
}
},
csscomb: {
dynamic_mappings: {
expand: true,
cwd: '<%= pkg.sassAppDir %>',
src: ['**/*.scss', '!**/lib/*.scss', '!**/sprites/*.scss', '!<%= pkg.theme %>/variables.scss'],
dest: '<%= pkg.sassAppDir %>',
options: {
config: 'csscomb.json'
}
}
},
watch: {
css: {
files: ['<%= pkg.watchSass %>'],
tasks: ['newer:csscomb', 'newer:compass:development'],
options: {
livereload: true
}
}
}
});
// Load the plugins
grunt.loadNpmTasks('grunt-csscomb');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-newer');
// Default task(s)
grunt.registerTask('default', ['watch']);
};
If I add a new file I get this output:
Running "newer:csscomb" (newer) task
Running "newer:csscomb:dynamic_mappings" (newer) task
Running "csscomb:dynamic_mappings" (csscomb) task
>> Using custom config file "csscomb.json"...
>> Sorting file "[...]/test3.scss"...
Running "newer-postrun:csscomb:dynamic_mappings:1:[...]/node_modules/grunt-newer/.cache" (newer-postrun) task
Running "newer:compass:development" (newer) task
No newer files to process.
Done, without errors.
compass:development should run, because it's a new file...
I figured out that compass is the problem. If I run grunt newer:compass:development
it will never find a new or updated file (also if I created a new file seconds ago without haven the grunt watcher started).
Running "newer:compass:development" (newer) task
No newer files to process.
Done, without errors.
I I just run grunt compass:development
, everything is working fine.
Running "compass:development" (compass) task
unchanged [...]/sprites/layout-s460f7606d1.png
identical [...]/category.css (0.547s)
[...]
create [...]/test.css (0.008s)
create [...]/test2.css (0.001s)
create [...]/test3.css (0.001s)
create [...]/test4.css (0.001s)
create [...]/test5.css (0.001s)
Compilation took 5.785s
Done, without errors.
I also get this problem using compass with the grunt-newer plugin. :(
You can use src in your compass config and it will work. E.g.
compass: {
src: '<%= pkg.sassAppDir %><%= pkg.theme %>/watchdir/**/*.scss',
options: {
sassDir: '<%= pkg.sassAppDir %><%= pkg.theme %>/watchdir',
@oliverchrist No, that didn't work :(
Have you tried putting "src" in the subtask, too?
In my config I'm checking the same folder and files for grunt-csscomb and grunt-compass. But if the newer task has checked the state for csscomb, it doesn't work for compass anymore. I need a way to say grunt-newer to check newer files for every task.