2020-09-23 09:08:21 -05:00
|
|
|
const gulp = require('gulp');
|
|
|
|
const postcss = require('gulp-postcss');
|
2021-08-14 11:49:32 -05:00
|
|
|
const sass = require('gulp-sass')(require('sass'));
|
|
|
|
const sourcemaps = require('gulp-sourcemaps');
|
2020-09-23 11:10:19 -05:00
|
|
|
const terser = require('gulp-terser');
|
2020-09-23 09:08:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
function html() {
|
2021-08-14 11:33:06 -05:00
|
|
|
return gulp.src('./src/index.html')
|
2021-01-29 16:56:37 -05:00
|
|
|
.pipe(gulp.dest('./dist/'));
|
2020-09-23 09:08:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function css() {
|
2021-08-14 11:49:32 -05:00
|
|
|
return gulp.src('./src/scss/*.scss')
|
|
|
|
.pipe(sourcemaps.init())
|
|
|
|
.pipe(sass.sync().on('error', sass.logError))
|
|
|
|
.pipe(postcss([require("autoprefixer"), require("postcss-csso")]))
|
|
|
|
.pipe(sourcemaps.write('.'))
|
2021-01-29 16:56:37 -05:00
|
|
|
.pipe(gulp.dest('./dist/'));
|
2020-09-23 09:08:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function js() {
|
2021-08-14 11:54:32 -05:00
|
|
|
return gulp.src('./src/main.js')
|
|
|
|
.pipe(sourcemaps.init())
|
2021-01-29 16:56:37 -05:00
|
|
|
.pipe(terser({ ecma: 5 }))
|
2021-08-14 11:54:32 -05:00
|
|
|
.pipe(sourcemaps.write('.'))
|
2021-01-29 16:56:37 -05:00
|
|
|
.pipe(gulp.dest('./dist/'));
|
2020-09-23 09:08:21 -05:00
|
|
|
}
|
|
|
|
|
2020-09-23 12:13:50 -05:00
|
|
|
function static() {
|
2021-01-29 16:56:37 -05:00
|
|
|
return gulp.src('./src/static/**/*')
|
|
|
|
.pipe(gulp.dest('./dist/'));
|
2020-09-23 12:13:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.default = gulp.parallel(html, css, js, static);
|
2020-09-23 09:08:21 -05:00
|
|
|
|
|
|
|
exports.watch = () => {
|
2021-01-29 16:56:37 -05: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 12:13:50 -05:00
|
|
|
}
|