-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
50 lines (44 loc) · 1.21 KB
/
gulpfile.js
File metadata and controls
50 lines (44 loc) · 1.21 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
43
44
45
46
47
48
49
50
var gulp = require('gulp'),
pug = require('gulp-pug'),
sass = require('gulp-sass'),
watch = require('gulp-watch'),
plumber = require('gulp-plumber');
var pathMaps = {
pugify: {
src: 'src/pug/pages/**/*.pug',
dest: 'docs/',
watch: 'src/pug/**/*.pug',
basedir: 'src/pug/'
},
sassify: {
src: 'src/sass/index.scss',
dest: 'docs/css/',
watch: 'src/sass/**/*.scss'
}
};
gulp.task('sassify', function() {
var mapping = pathMaps.sassify;
return gulp
.src(mapping.src)
.pipe(plumber())
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(mapping.dest))
});
gulp.task('pugify', function() {
var mapping = pathMaps.pugify;
return gulp
.src(mapping.src)
.pipe(plumber())
.pipe(pug({ basedir: mapping.basedir }))
.pipe(gulp.dest(mapping.dest))
});
gulp.task('watch', function() {
for(var taskName in pathMaps) {
if(pathMaps.hasOwnProperty(taskName)) {
var mapping = pathMaps[taskName];
console.log("...watching:", mapping.watch, "->", taskName)
gulp.watch(mapping.watch, [taskName]);
}
}
});
gulp.task('default', ['pugify', 'sassify']);