tschaub / grunt-newer

Configure Grunt tasks to run with newer files only.
https://npmjs.org/package/grunt-newer
MIT License
945 stars 53 forks source link

Multiples files and folders > No newer files to process #27

Closed dhenriet closed 10 years ago

dhenriet commented 10 years ago

I am trying to compile only changed 'less' but grunt-newer detect only some less changes, watch task detect them. /bootstrap and /views are ignored with this message : No newer files to process and /layout less files are compiled.

hereis my grunt's config

package.json

 "grunt": "~0.4.2",
 "grunt-contrib-watch": "~0.5.3",
 "grunt-contrib-compass": "~0.6.0",
 "assemble-less": "~0.7.0",
 "grunt-newer": "~0.6.1"

this is the structure :

grunt is in a grunt folder /grunt

less to compile /views/bloc/folder/.less /views/bloc/folder/folder/.less /views/layout/.less /web/assets/css/bootstrap/3-0-3/.less

compiled css /web/assets/css/.css

Grunfile.js

module.exports = function (grunt) {

    grunt.initConfig({

        pkg: grunt.file.readJSON('package.json'),

        css_path : '../web/assets/css',
        bootstrap_path : '<%= css_path %>/bootstrap/3-0-3',
        sass_path : '../views/common/components/sass',
        layout_path: '../views/layout',

        less: {

            development: {
                options: {
                    paths: ['<%= css_path %>']
                },
                files: {
                    '<%= css_path %>/bootstrap.css': '<%= bootstrap_path %>/bootstrap.less',
                    '<%= css_path %>/layoutb.css': '<%= layout_path %>/b.less',
                    '<%= css_path %>/layouta.css': '<%= layout_path %>/a.less',
                }
            },
            production: {
                options: {
                    paths: ['<%= css_path %>'],
                    cleancss: true,
                },
                files: {
                    '<%= css_path %>/bootstrap.css': '<%= bootstrap_path %>/bootstrap.less',
                    '<%= css_path %>/layoutb.css': '<%= layout_path %>/layoutb.less',
                    '<%= css_path %>/layouta.css': '<%= layout_path %>/layouta.less',
                }
            }
        },

        // https://github.com/gruntjs/grunt-contrib-compass
        compass: {
            dist: {
                options: {
                    raw: 'preferred_syntax = :scss\n',
                    noLineComments: true,
                    relativeAssets: true,
                    outputStyle: 'expanded',
                    cssDir: '<%= css_path %>/',
                    sassDir: '<%= sass_path %>/',
                    imagesDir: '../web/assets/img/sprites/',
                    //config: 'config.rb'
                }
            }
        },

        watch: {
            options: {
                spawn: false
            },
            gruntfile: {
                files: ['Gruntfile.js'],
                tasks: ['newer:less:development', 'compass']
            },
            stylesheets: {
                files: [
                    '<%= bootstrap_path %>/*.less',
                    '../views/bloc/**/*.less',
                    '<%= layout_path %>/**/*.less',
                ],
                tasks: ['newer:less:development']
            },
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('assemble-less');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-newer');

    grunt.registerTask('default', [
        'compass',
        'less',
    ]);
    grunt.registerTask('dev', [
        'watch'
    ]);

};
tschaub commented 10 years ago

I think this is essentially a duplicate of #29. Please reopen if you think it is a separate issue.

tschaub commented 10 years ago

See #35 for a proposed general solution and #29 for specific discussion regarding LESS.