0

I am trying to set up postcss grunt task, i am wanting to run the task on all files in css/ except default.css, how do i exclude certain files?

This is my task

        options: {
            processors: [
                require('autoprefixer')(),
                require('cssnext')(),
                require('precss')()
            ]
        },
        dist: {
            src: 'css/*.css',
            exclude: 'css/default.css'

        }

    }
Benjamin Oats
  • 573
  • 1
  • 8
  • 25
  • 1
    Possible duplicate of [Configure grunt copy task to exclude files/folders](http://stackoverflow.com/questions/15199092/configure-grunt-copy-task-to-exclude-files-folders) – ksav Sep 19 '16 at 14:03

2 Answers2

1

Checkout out the docs.

Paths matching patterns that begin with ! will be excluded from the returned array. Patterns are processed in order, so inclusion and exclusion order is significant.

options: {
    processors: [
      require('autoprefixer')(),
      require('cssnext')(),
      require('precss')()
    ]
  },
  dist: {
    src: ['css/*.css', '!css/default.css']
  }
ksav
  • 20,015
  • 6
  • 46
  • 66
0

Somthing like:

    dist: {
        src: ['css/*.css', '!css/default.css']
    }

should do the trick.

Have a read of the docs on grunt.file.match

Match one or more globbing patterns against one or more file paths. Returns a uniqued array of all file paths that match any of the specified globbing patterns. Both the patterns and filepaths argument can be a single string or array of strings. Paths matching patterns that begin with ! will be excluded from the returned array. Patterns are processed in order, so inclusion and exclusion order is significant.

Daft
  • 10,277
  • 15
  • 63
  • 105