-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (43 loc) · 1.13 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
41
42
43
44
45
46
47
48
49
var gulp = require('gulp'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
$ = require('gulp-load-plugins')();
gulp.task('styles', function() {
return gulp.src('src/styles/styles.scss')
.pipe($.plumber())
.pipe($.sourcemaps.init())
.pipe($.sass())
.pipe($.autoprefixer({ browsers: ['last 2 versions'], cascade: false}))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('.tmp'))
.pipe(reload({ stream: true }));
});
gulp.task('slides', function() {
return gulp.src('src/*.njk')
.pipe($.plumber())
.pipe($.nunjucksRender({
path: ['src', 'src/slides']
}))
.pipe(gulp.dest('.tmp'))
});
gulp.task('serve', ['styles', 'slides'], function() {
browserSync({
server: {
baseDir: ['.tmp', 'src']
}
});
gulp.watch('src/styles/**/*.scss', ['styles']);
gulp.watch('src/**/*.njk', ['slides']);
gulp.watch('.tmp/*.html').on('change', reload);
});
gulp.task('build', ['styles', 'slides'], () => {
return gulp.src([
'.tmp/*.*',
'src/**/*.*',
'!src/styles/**/*.*',
'!src/**/*.njk'
], {
dot: true
}).pipe(gulp.dest('dist'));
});
gulp.task('default', ['serve']);