-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
40 lines (33 loc) · 1.05 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";
var gulp = require('gulp');
var autoprefixer = require('autoprefixer')
var terser = require('gulp-terser');
const sass = require('gulp-sass')(require('sass'));
var postcss = require('gulp-postcss')
var flatten = require('gulp-flatten');
var spawn = require('child_process').spawn;
function styles(done) {
return gulp.src(['src/sass/screen.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(postcss([ autoprefixer() ]))
.pipe(gulp.dest('static/css/'))
.on('end', done);
}
function scripts(done) {
return gulp.src(['node_modules/@fortawesome/fontawesome-free/js/all.js',
'node_modules/materialize-css/dist/js/materialize.min.js'])
.pipe(flatten())
.pipe(terser())
.pipe(gulp.dest('static/js/'))
.on('end', done);
}
function up(done) {
spawn('hugo', ['serve', '-w', '-D'], {stdio: 'inherit'});
done();
}
function watchFiles(done) {
gulp.watch("src/sass/*.scss", styles);
done();
}
exports.build = gulp.parallel(styles, scripts);
exports.watch = gulp.parallel(watchFiles, up);