import gulp from 'gulp';
import imagemin from 'gulp-imagemin';
export default () => (
gulp.src('src/images/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/images'))
);
gulp.task('bundle-sw', async (done) => {
await workboxBuild.generateSW({
globDirectory: './',
swDest: './dist/sw.js',
globPatterns: ['**\/*.{html,js,css}']
});
done();
});
main.js
, т. к. gsap
и ScrollTrigger
Вы подключили в него. counter.js
. Хотите каждый раз новый контекст - делайте мини-фабрику (функцию высшего порядка):function createCounter() {
let counter = 0;
function increment() {
counter++;
console.log(counter);
}
function decrement() {
counter--;
console.log(counter);
}
return {
get value() {
return counter;
},
increment,
decrement
};
}
class App {
constructor() {
this.counter = createCounter();
this.subCounter = createCounter();
}
increment() {
this.counter.increment();
}
subIncrement() {
this.subCounter.increment();
}
}
node-sass
и ставим sass
вместо него.node-sass
:choco install visualstudio2017-workload-vctools -y
npm config set msvs_version 2017
choco install visualstudio2019-workload-vctools -y
npm config set msvs_version 2019
gulp-nunjucks-render
.gulp-nunjucks
в devDependencies.require
.nunjucksRender()
на nunjucks.compile()
.ReferenceError: gulp is not defined
gulp-sass
ошибок нет..pipe(gulp.dest('./css'))
const { src, dest, series } = require('gulp');
const through = require('through2');
const transformToJson = () => {
return src('./src/settings.js')
.pipe(through.obj((file, _, callback) => {
const computed = require(file.path);
file.extname = '.json';
file.contents = Buffer.from(JSON.stringify(computed, null, 4));
callback(null, file);
}))
.pipe(dest('./dist'));
};
module.exports.default = series(transformToJson);
let { src, dest } = require('gulp'),
gulp = require('gulp'),
- browsersync = require('browser-sync').create;
+ browsersync = require('browser-sync').create();