This repository has been archived by the owner on Aug 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
116 lines (113 loc) · 2.58 KB
/
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
112
113
114
115
116
const _ = require("lodash");
const path = require('path');
const gutil = require("gulp-util");
// ENV
const env = gutil.env.env || 'local';
// BASE PATHS
const src = path.resolve(__dirname, './src');
const dist = path.resolve(__dirname, './dist');
const assets = `${dist}/assets`;
const publicPath = '/assets';
const base = dist;
// PATHS
var paths = {
src: {
js: `${src}/js`,
json: `${src}/json`,
img: `${src}/img`,
icons: `${src}/icons`,
fonts: `${src}/fonts`,
base: src
},
dist: {
css: `${assets}/css`,
js: `${assets}/js`,
img: `${assets}/img`,
icons: `${assets}/img/icons`,
fonts: `${assets}/fonts`,
base: `${base}/`,
public: publicPath,
assets: assets
}
};
// CONSTANTS
var constants = {
default: {
api: ''
},
local: {
watch: {
icons: [`${paths.src.icons}/*.svg`],
images: [`${paths.src.img}/**/*`]
},
api: 'http://localhost:8000'
},
production: {
api: 'http://recipes.devcode.ninja'
}
};
// TASK TRIGGERS
var run = {
default: {
clean: false,
server: false,
build: false,
icons: false,
images: false,
fonts: false,
manifest: false,
},
local: {
clean: true,
server: true,
images: true,
icons: true,
fonts: true,
manifest: true
},
production: {
clean: true,
build: true,
images: true,
icons: true,
fonts: true,
manifest: true
}
};
// TASK OPTIONS
var plugin = {
default: {
clean: [
`${paths.dist.css}/*`,
`${paths.dist.js}/*`
],
svgstore: function(prefix) {
return {
plugins: [{
cleanupNumericValues: {
floatPrecision: 3
}
}, {
cleanupIDs: {
prefix: prefix + '-',
minify: true
}
}, {
cleanupListOfValues: false
}]
};
}
},
production: {
}
};
// MERGE CONFIG
var runOpts = _.merge({}, run.default, run[env]);
var pluginOpts = _.merge({}, plugin.default, plugin[env]);
var constantsOpts = _.merge({}, constants.default, constants[env]);
// EXPORT CONFIG
module.exports.paths = paths;
module.exports.constants = constantsOpts;
module.exports.run = runOpts;
module.exports.plugin = pluginOpts;
module.exports.env = env;