forked from devbridge/Front-End-Toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulp.config.js
111 lines (105 loc) · 3.29 KB
/
gulp.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
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
109
110
111
const argv = require("yargs").argv;
const ENV = process.env.npm_lifecycle_event;
const isProd = ENV && ENV.startsWith("build");
module.exports = function () {
const app = argv.app || "src";
const environment = argv.environment || "dev";
const distFolder = "dist";
const tmp = "tmp/";
const svg = {
sourceFolder: `${app}/scss/assets/icons/`,
spriteFolder: `${distFolder}/content/styles/images/`,
scssMapFolder: `${app}/scss/base/`,
scssTemplateFolder: `${app}/scss/base/`,
pngFallback: true
};
const config = {
tmp,
root: "./",
packages: [
"./package.json"
],
custom: {
foldersToLint: ["src"]
},
path: {
HTML: "/index.html",
ALL: [`${app}/src/main.js`],
MINIFIED_OUT: "build.min.js",
DEST_SRC: "scripts",
DEST_BUILD: "scripts",
DEST: distFolder
},
environmentConfig: {
source: `config/${environment}.js`
},
svg: {
sourceFolder: svg.sourceFolder,
spriteFolder: svg.spriteFolder,
scssMapFolder: svg.scssMapFolder,
pngFallback: svg.pngFallback
},
html: {
src: [
`./${app}/**/*.html`
],
dest: 'public'
},
scss: {
src: [
`./${app}/scss/**/*.scss`,
`./${app}/components/**/*.scss`,
`!./${app}/scss/**/*_scsslint_tmp*.scss` //ignores temporary scss-lint files
],
lint: [
`./${app}/scss/**/*.scss`,
`!./${app}/scss/base/_svg-sprite-map.scss`,
`!./${app}/scss/base/_svg-sprite.scss`,
`!./${app}/scss/**/*_scsslint_tmp*.scss`,
`!./${app}/scss/vendor/**/*.scss`,
`!./${app}/scss/base/_svg-sprite-map.scss`
],
cssFolder: `${distFolder}/content/styles/`
}
,
optimize: {
css: {},
js: {},
images: {
src: `${app}/assets/images/**/*.{png,gif,jpg,svg}`,
dest: `${distFolder}/images/`,
options: { // Target options
optimizationLevel: 7,
svgoPlugins: [{removeViewBox: false}],
progessive: true,
interlaced: true
}
}
},
svgConfig: {
shape: {
spacing: {
padding: 4
}
},
variables: {
version: Math.round(+new Date() / 1000)
},
mode: {
css: {
bust: false,
dest: "./",
// layout: "vertical", "horizontal", "diagonal"
sprite: svg.spriteFolder + "sprite.svg",
render: {
scss: {
dest: svg.scssMapFolder + "_svg-sprite-map.scss",
template: svg.scssTemplateFolder + "_svg-sprite-template.mustache"
}
}
}
}
}
};
return config;
};