Answer the question
In order to leave comments, you need to log in
How to copy needed files via gulp?
Why is my public folder deleted on first launch? After restart everything is ok.
How to write in this line
return gulp.src('frontend/assets/{fonts,images}/**', {since: gulp.lastRun('assets')})
so that not only the fonts, images folders would be copied, but also the index.html file for example? const gulp = require('gulp');
const concatCSS = require('gulp-concat-css');
const debug = require('gulp-debug');
const sourcemaps = require('gulp-sourcemaps');
const gulpIf = require('gulp-if');
const del = require('del');
const isDevelopment = !process.env.NODE_ENV || process.env.NODE_ENV == 'development';
gulp.task('styles', function () {
return gulp.src('frontend/**/*.css')
.pipe(concatCSS('all.css'))
.pipe(gulpIf(isDevelopment, sourcemaps.init()))
.pipe(gulpIf(isDevelopment, sourcemaps.write()))
.pipe(gulp.dest('public'));
});
gulp.task('clean', function() {
return del('public');
});
gulp.task('assets', function() {
return gulp.src('frontend/assets/{fonts,images}/**', {since: gulp.lastRun('assets')})
.pipe(gulp.dest('public'));
});
gulp.task('build', gulp.series(
'clean',
gulp.parallel('styles', 'assets'))
);
gulp.task('watch', function() {
gulp.watch('frontend/styles/**/*.*', gulp.series('styles'));
gulp.watch('frontend/assets/**/*.*', gulp.series('assets'));
});
gulp.task('dev', gulp.series('build', 'watch'));
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