-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgulpfile.js
More file actions
42 lines (34 loc) · 1.12 KB
/
gulpfile.js
File metadata and controls
42 lines (34 loc) · 1.12 KB
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
41
42
const gulp = require('gulp')
const htmlbeautify = require('gulp-html-beautify')
const sass = require('gulp-sass')(require('sass'))
const { renameSync, mkdirSync, rmSync } = require('fs')
// internal tasks
gulp.task('setup', done => {
rmSync('./build/', { recursive: true, force: true })
renameSync('./site/', './build/')
mkdirSync('./site/')
done()
})
gulp.task('copy', () => {
return gulp.src('./build/**/*')
.pipe(gulp.dest('./site/'))
})
gulp.task('htmlbeautify', () => {
const beautifyOptions = {
indent_size: 1,
indent_char: '\t',
}
return gulp.src('./build/**/*.html')
.pipe(htmlbeautify(beautifyOptions))
.pipe(gulp.dest('./site/', { overwrite: true }))
})
// external tasks
gulp.task('buildstyles', () => {
return gulp.src('./styles/**/*.scss')
.pipe(sass({ outputStyle: 'compressed', sourceComments: false }).on('error', sass.logError))
.pipe(gulp.dest('./docs/'))
})
gulp.task('watchstyles', () => {
gulp.watch('./styles/**/*.scss', gulp.task('buildstyles'))
})
gulp.task('postbuild', gulp.series('setup', 'copy', 'htmlbeautify'))