-
Notifications
You must be signed in to change notification settings - Fork 36
/
bundle.config.js
59 lines (52 loc) · 1.31 KB
/
bundle.config.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
var coffee = require('gulp-coffee');
var lazypipe = require('lazypipe');
var sass = require('gulp-sass');
var less = require('gulp-less');
var gif = require('gulp-if');
function stringEndsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
function isCoffeeFile(file) {
return stringEndsWith(file.relative, 'coffee');
}
function isScssFile(file) {
return stringEndsWith(file.relative, 'scss');
}
function isLessFile(file) {
return stringEndsWith(file.relative, 'less');
}
var scriptTransforms = lazypipe()
.pipe(function() {
// when using lazy pipe you need to call gulp-if from within an anonymous func
// https://github.com/robrich/gulp-if#works-great-inside-lazypipe
return gif(isCoffeeFile, coffee());
});
var styleTransforms = lazypipe()
.pipe(function() {
return gif(isScssFile, sass());
})
.pipe(function() {
return gif(isLessFile, less());
});
module.exports = {
bundle: {
article: {
scripts: [
'./content/**/*.coffee',
'./content/**/*.js'
],
styles: [
'./content/**/*.scss',
'./content/**/*.less',
'./content/**/*.css'
],
options: {
minCSS: true,
transforms: {
scripts: scriptTransforms,
styles: styleTransforms
}
}
}
}
};