There is a task that clears the folder before building
gulp.task('clear', function () { return del.sync('MyPage'); }); How to make it delete all folders except one, for example img ?
There is a task that clears the folder before building
gulp.task('clear', function () { return del.sync('MyPage'); }); How to make it delete all folders except one, for example img ?
This is how it works:
['!dist/.git','dist/**/*'] 'dist/**/*' - files in the folder are deleted here, and if 'dist/**' , then the entire dist folder is deleted and '!dist/.git' does not save.
In this particular case, I don’t touch .git, if I only register 'dist/**/*'
del by default does not delete folders whose name starts with a dot
Try this:
var gulp = require('gulp'); var del = require('del'); gulp.task('clear', function () { del.sync(['path/**', '!path/yourFolder']); }); yourFolder is the name of your folder, path is the path.
./** !./img )? Previous task deleted? - user192664del.sync(['MyPage/**', '!MyPage/.git']); folder del.sync(['MyPage/**', '!MyPage/.git']); - MegaRoks.git file in a folder? - user192664.git file in the folder - MegaRoksSource: https://ru.stackoverflow.com/questions/848306/
All Articles