Gillespie
Gillespie

Reputation: 6561

Cleaning directories ending in `.js`

I am writing a grunt task to clean out unneeded bower files. however, I'm having a difficult time getting it to play nice with Chart.js since the directory itself ends in .js.

This is what I currently have, but it is not working (it's still deleting the entire directory Chart.js when in reality I want it to only delete files):

bower: {
    src: [
        '!build/bower_components/**/*.min.js',
        '!build/bower_components/Chart.js/',
        'build/bower_components/**/*.js'
    ]
}

Any tips?

Upvotes: 1

Views: 30

Answers (1)

DavidT
DavidT

Reputation: 2481

From the comments under the actual question, trying '!build/bower_components/*.js' would seem to fix the problem.

My guess is that it is simply matching the glob its using to match against strings as directory structures. And Chart.js matches ../*.js regardless of it being a directory.

Also as you mention yourself in the comments - putting the ! (not) directory strings at the bottoms also helps.

Upvotes: 1

Related Questions