Answer the question
In order to leave comments, you need to log in
How to fix 'deston is not a function' error?
"use strict";
const {src, dest, parallel, watch} = pkg;
import pkg from 'gulp';
import pug from 'gulp-pug';
import plumber from 'gulp-plumber';
import server from 'browser-sync';
import sass from 'gulp-dart-sass';
import autoPrefixer from 'gulp-autoprefixer';
import concat from 'gulp-concat';
import imagemin from 'imagemin';
import webp from 'gulp-webp';
import newer from 'gulp-newer';
import minify from 'gulp-jsmin';
import sourcemaps from 'gulp-sourcemaps';
const pugfiles = () =>{
return src('src/*.pug')
.pipe(plumber())
.pipe(pug({
pretty: true
}))
.pipe(dest('./dist'))
};
const serve = () =>{
server.init({
server: {baseDir: './dist'},
notify: false,
online: true
})
};
const styles = () =>{
return src('src/scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed'
}).on('error' , sass.logError))
.pipe(autoPrefixer())
.pipe(concat('style.min.css'))
.pipe(sourcemaps.write('../maps'))
.pipe(dest('dist/css'))
};
const scripts = () =>{
return src('src/js/*.js')
.pipe(plumber())
.pipe(concat('app.min.js'))
.pipe(minify())
.pipe(dest('dist/js'))
};
const images = () =>{
return src('src/images/**/*')
.pipe(newer('dist/images/'))
.pipe(imagemin())
.pipe(webp())
.pipe(dest('dist/images'))
}
const watcher = () =>{
watch('src/**/*.pug', pugfiles).on('change', server.reload);
watch('src/**/*.scss', styles).on('change', server.reload);
watch(['src/js/**/*.js', '!src/js/**/*.min.js'], scripts).on('change', server.reload);
watch('src/images/**/*', images);
};
export default parallel(
pugfiles,
serve,
watcher,
styles,
scripts,
images
);
PS E:\projects\git\test-gulp> gulp
[00:14:18] Using gulpfile E:\projects\git\test-gulp\gulpfile.js
[00:14:18] Starting 'default'...
[00:14:18] Starting 'pugfiles'...
[00:14:18] Starting 'serve'...
[00:14:18] Starting 'watcher'...
[00:14:18] Starting 'styles'...
[00:14:18] Starting 'scripts'...
[00:14:18] Starting 'images'...
[00:14:19] 'images' errored after 106 ms
[00:14:19] TypeError: dest.on is not a function
at Newer.Readable.pipe (internal/streams/readable.js:652:8)
at images (file:///E:/projects/git/test-gulp/gulpfile.js:59:6)
at bound (domain.js:416:15)
at runBound (domain.js:427:12)
at asyncRunner (E:\projects\git\test-gulp\node_modules\async-done\index.js:55:18)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
[00:14:19] 'default' errored after 114 ms
Answer the question
In order to leave comments, you need to log in
https://stackoverflow.com/questions/38253949/gulp-...
Service rules :
2. Before asking a question, the user of the Service must:
2.2 Make sure that there are no answers to this question on the Internet, and on the pages of the Service in particular. Especially for this, talented IT specialists have created and are developing the Yandex and Google search engines.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question