Last Updated: February 25, 2016
·
3.479K
· jfroom

Ignoring Files and Folders with Grunt Contrib Clean

Frank Stallone had a good start on how to do this:
http://iamfrankstallone.com/ignoring-files-grunt-contrib-clean/

I wanted to share (and also post so I would have a place to reference it myself!) how to exclude specific files. In this example, I wanted to delete all files EXCEPT the font-awesome/fonts/* and requirejs/*.js:

clean:
    distFinal:
            files: [
              dot: true
              src: [
                "<%= yeoman.dist %>/bower_components/*"
                "!<%= yeoman.dist %>/bower_components/font-awesome/**"
                "<%= yeoman.dist %>/bower_components/font-awesome/*"
                "!<%= yeoman.dist %>/bower_components/font-awesome/fonts"
                "!<%= yeoman.dist %>/bower_components/requirejs/**"
                "<%= yeoman.dist %>/bower_components/requirejs/*"
                "!<%= yeoman.dist %>/bower_components/requirejs/*.js"
              ]
            ]

1 Response
Add your response

Thank you. That was very helpful!

over 1 year ago ·