1

I am facing an issue with grunt-contrib-less plugin.

Problem Explanation

I have multiple less partials files which i am including in a main.less file. My grunt watch listen for changes in less files and run the less task. The problem is grunt contrib less is compiling the partials individually which throws error as some variable not define (which is actually defined in _var.less file). I tried to negate the partials in my grunt file, but its not working. here is my grunt config.

less: {
        development: {
            options: {
                compress: false,
                yuicompress: false/*,
                optimization: 2*/
            },
            files: [
                {
                    expand: true,
                    cwd: 'css/less',
                    //src: ['*.less'],
                    src: ['*.less', "!_*.less"],
                    // dest: 'dest/css/',
                    dest: 'css/',
                    ext: '.css'
                }
            ]
        }
    }, 
    watch: {            
        styles: {
            files: ['css/less/*.less'], // which files to watch
            tasks: ['less'],
            options: {
                nospawn: true
            }
        }
    }

Please tell me what is wrong here.

atul
  • 552
  • 4
  • 16
  • is there anyone who can help.... – atul Aug 13 '17 at 10:27
  • In your `less` task *do not* compile *all* the files but only the files that need to be compiled (i.e. the only "master" file). This should be pretty self-evident (you try to compile the files that are not supposed to be compiled and obviously they complain). – seven-phases-max Aug 22 '17 at 21:32

0 Answers0