2020-09-23 16:08:21 +02:00
|
|
|
const gulp = require('gulp');
|
|
|
|
const postcss = require('gulp-postcss');
|
|
|
|
const pug = require('gulp-pug');
|
2021-03-12 20:31:20 +01:00
|
|
|
const { sass, sassSync } = require("@mr-hope/gulp-sass");
|
2020-09-23 18:10:19 +02:00
|
|
|
const terser = require('gulp-terser');
|
2020-09-23 16:08:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
function html() {
|
2021-01-29 22:56:37 +01:00
|
|
|
return gulp.src('./src/index.pug')
|
|
|
|
.pipe(pug())
|
|
|
|
.pipe(gulp.dest('./dist/'));
|
2020-09-23 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function css() {
|
2021-01-29 22:56:37 +01:00
|
|
|
return gulp.src('./src/style/*.scss')
|
2021-03-12 20:31:20 +01:00
|
|
|
.pipe(sassSync().on('error', sass.logError))
|
2021-01-29 22:56:37 +01:00
|
|
|
.pipe(postcss([require('autoprefixer'), require('cssnano')]))
|
|
|
|
.pipe(gulp.dest('./dist/'));
|
2020-09-23 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function js() {
|
2021-01-29 22:56:37 +01:00
|
|
|
return gulp.src('./src/script/index.js')
|
|
|
|
.pipe(terser({ ecma: 5 }))
|
|
|
|
.pipe(gulp.dest('./dist/'));
|
2020-09-23 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
2020-09-23 19:13:50 +02:00
|
|
|
function static() {
|
2021-01-29 22:56:37 +01:00
|
|
|
return gulp.src('./src/static/**/*')
|
|
|
|
.pipe(gulp.dest('./dist/'));
|
2020-09-23 19:13:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.default = gulp.parallel(html, css, js, static);
|
2020-09-23 16:08:21 +02:00
|
|
|
|
|
|
|
exports.watch = () => {
|
2021-01-29 22:56:37 +01:00
|
|
|
gulp.watch('./src/index.pug', html);
|
|
|
|
gulp.watch('./src/style/*.scss', css);
|
|
|
|
gulp.watch('./src/script/index.js', js);
|
|
|
|
gulp.watch('./src/static/*', static);
|
2020-09-23 19:13:50 +02:00
|
|
|
}
|