-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.config.js
57 lines (50 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
var lazypipe = require('lazypipe');
var sass = require('gulp-sass');
var less = require('gulp-less');
var gif = require('gulp-if');
var ts = require('gulp-typescript');
function stringEndsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
function isScssFile(file) {
return stringEndsWith(file.relative, 'scss');
}
function isLessFile(file) {
return stringEndsWith(file.relative, 'less');
}
function isTypeScriptFile(file) {
return stringEndsWith(file.relative,'ts');
}
var styleTransforms = lazypipe()
.pipe(function() {
return gif(isScssFile, sass());
})
.pipe(function() {
return gif(isLessFile, less());
});
var scriptTransforms = lazypipe()
.pipe(function(){
return gif(isTypeScriptFile, ts());
});
module.exports = {
bundle: {
main: {
scripts: [
'./src/scripts/file1.js',
'./src/scripts/file2.js',
'./src/scripts/tps.ts'
],
styles: [
'./src/styles/style1.css',
'./src/styles/style2.css',
'./src/styles/sass.scss'
],
options: {
transforms:{
styles: styleTransforms,
scripts: scriptTransforms
}
}
}
}
}