Allow skip files or folder from sync delete.
nathanredblur opened this issue · comments
That, I wonder if I can tell to the sync function to sync all files and folder except my "/uploads" folder.
Thanks :)
you can create a couple of gulp streams and the one that deal with upload wont pipe into sync()
Let me know if this works
How can I do?
this is my folder is like this but whit more folders and files in others difference paths
dist/
`--public/
|--icon.ico
|--xml.xml
|--css/
| `--css.css
|--scripts/
| `--script.js
|--assets/
| `--script.js
`--uploads/
`--empty--
all that files can change but uploads folder always will be empty in local, but with other random files in S3.
this is my current task
gulp.task('publish', function () {
var gzip = gulp.src('dist/public/**/*.{js,css}').pipe(awspublish.gzip());
var plain = gulp.src([ 'dist/public/**/*', '!dist/public/**/*.{js,css}' ]);
return merge(gzip, plain)
.pipe(publisher.publish(headers))
.pipe(publisher.sync())
.pipe(publisher.cache())
.pipe(awspublish.reporter());
});
the base is "dist/public/" then all files goes to the right path in the s3 bucket.
but "uploads/" is synchronised too and all files on it deleted.
sorry, can you help me? I don't get it. Not easy solution just a solution where I must to specify a lot of files and folders to skip the upload folder.
I found a solution just adding more sync with prefix to the critical folders
gulp.task('publish', function () {
var gzip = gulp.src('dist/public/**/*.{js,css}').pipe(awspublish.gzip());
var plain = gulp.src([ 'dist/public/**/*', '!dist/public/**/*.{js,css}' ]);
return merge(gzip, plain)
.pipe(publisher.publish(headers))
.pipe(publisher.sync('css/'))
.pipe(publisher.sync('scripts/'))
.pipe(publisher.sync('assets/'))
.pipe(publisher.cache())
.pipe(awspublish.reporter());
});
I hope this help someone else.
note: sync allow array publisher.sync(['css/','scripts/'])
but not works for me.