-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
35 lines (30 loc) · 1001 Bytes
/
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
var gulp = require('gulp');
var serve = require('gulp-serve');
var nunjucksRender = require('gulp-nunjucks-render');
var browserSync = require('browser-sync').create();
gulp.task('serve', serve('app'));
gulp.task('build', function() {
//gets .html and .nunjucks files in pages
return gulp.src('app/pages/**/*.+(html|nunjucks)')
//Renders template with nunjucks
.pipe(nunjucksRender({
path: ['app/templates']
}))
//outputs files in app folder
.pipe(gulp.dest('app'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: 'app/'
},
})
})
gulp.task('watch', ['browserSync', 'build'], function() {
gulp.watch('app/templating/partials/**/*.+(html|nunjucks)', ['build']);
gulp.watch('app/templating/**/*.+(html|nunjucks)', ['build']);
gulp.watch('app/pages/**/*.+(html|nunjucks)', ['build']);
});