Search code examples
cssgruntjsanimate.cssglob

Unique grunt globbing issue


Animate.css is an amazing library that I'm pulling into my project via bower (can't change the folder name). Unfortunately, the folder's name is "animate.css". I want to glob in my whole project (including bower_components) for /**.*.css. Unfortunately, grunt gets angry because animate.css is a folder, not a file. I need a way to ignore the folder, but not the file. Any tips?

Here's what my task looks like now:

cssmin: {
  deploy: {
    files: {
      '<%= config.prod %>/styles.min.css': ['<%= config.copy %>/**/*.css', '!**/animate.css/']
    }
  }
}

I have an issue on the project. Feel free to respond there.


Solution

  • You can supply a filter property to the files object to filter out directories:

    cssmin: {
      deploy: {
        files: [
          {
            src: ['<%= config.copy %>/**/*.css'],
            dest: '<%= config.prod %>/styles.min.css',
            filter: 'isFile'
          }
        ]
      }
    }