Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while checking same folder for two different tasks #50

Open
mbrammer opened this issue Jun 13, 2014 · 7 comments
Open

Error while checking same folder for two different tasks #50

mbrammer opened this issue Jun 13, 2014 · 7 comments

Comments

@mbrammer
Copy link

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.

@tschaub
Copy link
Owner

tschaub commented Jun 13, 2014

Can you provide a link to or paste the relevant bits of your config?

@mbrammer
Copy link
Author

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...

@mbrammer
Copy link
Author

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.

@benje
Copy link

benje commented Sep 5, 2014

I also get this problem using compass with the grunt-newer plugin. :(

@oliverchrist
Copy link

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',

@mbrammer
Copy link
Author

@oliverchrist No, that didn't work :(

@oliverchrist
Copy link

Have you tried putting "src" in the subtask, too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants