Answer the question
In order to leave comments, you need to log in
How to sync folders in Gulp?
I used all packages from npm. gulp-sync-dir works best.
I have the following source structure:
src
--img
----logo1.png
----logo2.png
--pug
----index.pug
----about.pug
--scss
----main. scss
----variables.scss
And output:
dist
--img
----logo1.png
----logo2.png
--css
----main.css
--index.html
--about.html
And such sycnDir task settings:
var syncDir = require('gulp-sync-dir');
gulp.task('sync-dir', function () {
syncDir({
src: 'src',
target: 'dist',
exclude: ['*.html', '*.css'],
});
});
gulp.task('watch', function () {
gulp.watch('src/pug/**/*', ['pug']);
gulp.watch('src/scss/**/*', ['scss']);
gulp.watch('src/img/**/*', ['img', 'sync-dir']);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question