forked from geedmo/yamm3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
108 lines (86 loc) · 1.89 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
var gulp = require('gulp'),
jade = require('gulp-jade'),
less = require('gulp-less'),
path = require('path'),
marked = require('marked'), // For :markdown filter in jade
path = require('path'),
htmlhint = require("gulp-htmlhint");
// SOURCES CONFIG
var source = {
templates: {
app: {
files : ['demo/jade/index.jade'],
watch: ['demo/jade/*.jade']
}
},
styles: {
app: {
main: ['yamm/yamm.less'],
dir: 'yamm',
watch: ['yamm/yamm.less']
}
}
};
// BUILD TARGET CONFIG
var build = {
styles: './yamm',
templates: {
app: './'
}
};
// Error handler
function handleError(err) {
console.log(err.toString());
this.emit('end');
}
//---------------
// TASKS
//---------------
// LESS
gulp.task('yamm', function() {
return gulp.src(source.styles.app.main)
.pipe(less({
paths: [source.styles.app.dir]
}))
.on("error", handleError)
.pipe(gulp.dest(build.styles))
;
});
// JADE
gulp.task('templates', function() {
return gulp.src(source.templates.app.files)
.pipe(jade({
pretty: true
}))
.on("error", handleError)
.pipe(htmlhint())
.pipe(htmlhint.reporter())
.pipe(gulp.dest(build.templates.app))
;
});
//---------------
// WATCH
//---------------
// Watch changes
gulp.task('watch:demo', function() {
gulp.watch(source.templates.app.watch, ['templates']);
});
gulp.task('watch:yamm', function() {
gulp.watch(source.styles.app.watch, ['yamm']);
});
//---------------
// DEFAULT TASK
//---------------
gulp.task('default', [
'yamm',
'watch:yamm'
]);
//---------------
// DEMO TASK
//---------------
gulp.task('demo', [
'yamm',
'templates',
'watch:yamm',
'watch:demo'
]);