1

how to exclude certain files from a directory from watched. for eg I have a stylesheets folder I am watching for *.css and create a *.min.css using cssmin. But it keeps going in a loop as the folder watched has a new/changed *.min.css(ending in css).

    'stylesheet-css':
        files: ['public/stylesheets/*.css']
        tasks:['cssmin:stylesheet-css']

I tried couple of things..

'stylesheet-css':
    files: [ '!(public/stylesheets/*.min.css)']  # any thing other than .min.css
    tasks:['cssmin:stylesheet-css']

doesn't seem to work

coool
  • 8,085
  • 12
  • 60
  • 80

1 Answers1

3

You need to specify the files you want, then the files you don't want (both sets), so something like:

'stylesheet-css':
    files: ['public/stylesheets/*.css', '!public/stylesheets/*.min.css']
    tasks:['cssmin:stylesheet-css']

For reference, see Grunt globbing patterns.

Jordan Kasper
  • 13,153
  • 3
  • 36
  • 55