-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
45 lines (40 loc) · 1.07 KB
/
gulpfile.babel.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
41
42
43
44
45
import gulp from 'gulp';
import serve from 'gulp-webserver';
import gulpPug from 'gulp-pug';
import sass from 'gulp-sass';
import compass from 'compass-importer';
import plumber from 'gulp-plumber';
import marked from 'marked';
import pug from 'pug';
import fs from 'fs'
import inlineCss from 'gulp-inline-css';
pug.filters.markdownInclude = function (filePath) {
var str = fs.readFileSync(filePath).toString();
return marked(str);
}
gulp.task('watch', () => {
gulp.watch(["src/*.pug", "src/**/*.pug", "src/**/*.md"], ['pug']);
gulp.watch(["src/sass/*.scss", "src/sass/**/*.scss"], ["sass"]);
});
gulp.task('pug', () => {
gulp.src('src/*.pug')
.pipe(plumber())
.pipe(gulpPug({
pug: pug
}))
.pipe(gulp.dest('./docs/'));
});
gulp.task('sass', () => {
gulp.src('./src/sass/style.scss')
.pipe(plumber())
.pipe(sass({ importer: compass }))
.pipe(gulp.dest('./docs/css'));
});
gulp.task('serve', () => {
gulp.src('docs/')
.pipe(serve({
livereload: true,
open: true
}));
});
gulp.task("default", ['sass', 'pug', 'serve', 'watch']);