How would you negate the cleaning of a particular folder using grunt-contrib-clean. Negating the match doesn't appear to work.
clean: {
plugins: [
'app/plugins/myplugin',
'!app/plugins/myplugin/assets'
]
}
I've tried a couple different negation patterns, such as:
'!app/plugins/myplugin/assets'
'!app/plugins/myplugin/assets/**'
as well as, reversing the positions in the array in case that mattered. Can't seem to hold onto the assets folder/contents on clean. The assets folder contains jQuery, AngularJS, and built Bootstrap (SASS), which I don't want to have to keep copying/building, seems a waste of time.
How would you negate the cleaning of a particular folder using grunt-contrib-clean. Negating the match doesn't appear to work.
clean: {
plugins: [
'app/plugins/myplugin',
'!app/plugins/myplugin/assets'
]
}
I've tried a couple different negation patterns, such as:
'!app/plugins/myplugin/assets'
'!app/plugins/myplugin/assets/**'
as well as, reversing the positions in the array in case that mattered. Can't seem to hold onto the assets folder/contents on clean. The assets folder contains jQuery, AngularJS, and built Bootstrap (SASS), which I don't want to have to keep copying/building, seems a waste of time.
Share Improve this question edited Jul 4, 2014 at 7:43 ConcurrentHashMap 5,0847 gold badges47 silver badges54 bronze badges asked Jul 4, 2014 at 6:47 mtpultzmtpultz 18.3k24 gold badges126 silver badges209 bronze badges2 Answers
Reset to default 14I quickly set up a folder structure like you're referencing and tried the following, that works for me:
clean: {
options: {
'no-write': true
},
plugins: ['app/plugins/myplugin/**/*', '!app/plugins/myplugin/assets/**']
}
The first wildcard selects all files inside the myplugin folder and all subfolders (but not the directory myplugin
itself!), while the negation deselects the whole assets directory including all subfolders and files.
You should remove the options field for real testing, as no-write: true
is only simulating a clean but doesn't actually delete files.
Hope that helps!
I wanted the ability to blow away all of bower_ponents except for require.js. Here is how I did it in my gruntFile:
/* all bower ponents except require */
applicationDistHome + '/bower_ponents/**/*',
'!' + applicationDistHome + '/bower_ponents/requirejs/**',
applicationDistHome + '/bower_ponents/requirejs/*',
'!' + applicationDistHome + '/bower_ponents/requirejs/require.js',