This repository has been archived on 2024-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
share2fedi/gulpfile.js

41 lines
973 B
JavaScript
Raw Normal View History

2020-09-23 09:08:21 -05:00
const gulp = require('gulp');
const postcss = require('gulp-postcss');
const pug = require('gulp-pug');
const sass = require('gulp-sass');
2020-09-23 11:10:19 -05:00
const terser = require('gulp-terser');
2020-09-23 09:08:21 -05:00
sass.compiler = require('sass');
function html() {
return gulp.src('./src/index.pug')
.pipe(pug())
.pipe(gulp.dest('./dist/'));
2020-09-23 09:08:21 -05:00
}
function css() {
return gulp.src('./src/style/*.scss')
.pipe(sass.sync().on('error', sass.logError))
.pipe(postcss([require('autoprefixer'), require('cssnano')]))
.pipe(gulp.dest('./dist/'));
2020-09-23 09:08:21 -05:00
}
function js() {
return gulp.src('./src/script/index.js')
.pipe(terser({ ecma: 5 }))
.pipe(gulp.dest('./dist/'));
2020-09-23 09:08:21 -05:00
}
2020-09-23 12:13:50 -05:00
function static() {
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 = () => {
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
}