forked from bquarks/polygulp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
99 lines (87 loc) · 2.64 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
/* global module, require, console */
module.exports = function(gulp, options) {
'use strict';
var _ = require('underscore');
// postcss plugins
var path = require('path');
var customMedia = require('postcss-custom-media');
var nested = require('postcss-nested');
var autoprefixer = require('autoprefixer');
var extend = require('deep-extend');
var atImport = require('postcss-import');
var defaults = {
projectInfo: {
versionRegex: /(version\s?[=:]\s?)["']\d.{3,}['"]/g, // version: 0.0.0 || version = 0.0.0
versionFiles: [],
},
paths: {
tmp: '.tmp',
app: 'app',
dist: 'dist',
test: 'test',
translations: ''
},
postcssProcessors: [
atImport,
customMedia,
nested,
autoprefixer({
browsers: [
'ie >= 10',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10'
]
})
],
optimize: {
html: {
quotes: true,
empty: true,
spare: true,
loose: true
},
image: {
progressive: true,
interlaced: true,
svgoPlugins: [
{ collapseGroups: false }
]
}
},
vulcanize: {
implicitStrip: true,
stripComments: true,
inlineCss: true,
inlineScripts: true
}
};
// Merge user settings with default config
var config = extend({}, defaults, options);
// Get the correct dist path
config.findPath = function(subpath) {
return !subpath ? config.paths.dist : path.join(config.paths.dist, subpath);
};
// Get the correct tmp path
config.findTmpPath = function(subpath) {
return subpath ? path.join(config.paths.tmp, subpath) : config.paths.tmp;
};
// Load tasks for web-component-tester
// Adds tasks for `gulp test:local` and `gulp test:remote`
// require('web-component-tester').gulp.init(gulp);
// Load custom tasks from the `tasks` directory
try {
var tasks = require('require-dir')('./tasks');
_.each(tasks, function(task) {
task(gulp, config);
});
} catch (err) {
console.log('Error: ', err);
}
return config;
};