forked from laravel/elixir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.js
447 lines (372 loc) · 13.4 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
var p = require('path');
var gutils = require('gulp-util');
/*
|----------------------------------------------------------------
| Master Configuration
|----------------------------------------------------------------
|
| This file contains the proper paths and options for each and
| and every Gulp task that Elixir wraps up. To override any
| setting, reference elixir.config.* from your Gulpfile.
|
| Alternatively you may create an elixir.json file within your
| project root. As JSON, modify any settings contained here
| and they'll take precedence over these defaults. Easy!
|
*/
var config = {
/*
|----------------------------------------------------------------
| Tasks
|----------------------------------------------------------------
|
| The tasks array stores all tasks that should be executed each
| time you trigger Gulp from the command line. Generally you
| won't need to modify this but it's an option if needed.
|
*/
tasks: [],
/*
|----------------------------------------------------------------
| Production Mode
|----------------------------------------------------------------
|
| Elixir will trigger certain actions, dependent upon this flag.
| You may "turn on" this mode by triggering "gulp --production".
| This will enable such things, like CSS and JS minification.
|
*/
production: !! gutils.env.production,
/*
|----------------------------------------------------------------
| Assets Path
|----------------------------------------------------------------
|
| This assets path property is prefixed to all relevant assets
| in your application. For example, "resources/assets/sass"
| or "resources/assets/coffee." Change this if you must.
|
*/
assetsPath: 'resources/assets',
/*
|----------------------------------------------------------------
| Public Path
|----------------------------------------------------------------
|
| Much like assets path, this public path property is prefixed to
| any paths in your application, that point to the public dir.
| It's useful, when a server requires a unique public path.
|
*/
publicPath: 'public',
/*
|----------------------------------------------------------------
| App Path
|----------------------------------------------------------------
|
| The app path, you guessed it, specifies the path to the app
| folder in your project. If using Laravel, then you won't
| need to modify this path. Otherwise modify as needed.
|
*/
appPath: 'app',
/*
|----------------------------------------------------------------
| Sourcemaps
|----------------------------------------------------------------
|
| A sourcemap is a JSON mapping, which declares a relationship
| between a minified file and its original source location.
| Quite useful for debugging, it's turned on by default.
|
*/
sourcemaps: ! gutils.env.production,
/*
|----------------------------------------------------------------
| File System Event Batching
|----------------------------------------------------------------
|
| You likely won't need to modify this object. That said, should
| you need to, these settings are exclusive to the watch task.
| They set the limit and timeout for running batch-updates.
|
*/
batchOptions: {
// https://github.com/floatdrop/gulp-batch#batchoptions-callback-errorhandler
limit: undefined,
timeout: 1000
},
css: {
/*
|----------------------------------------------------------------
| CSS Source Folder
|----------------------------------------------------------------
|
| This property declares the root folder for all vanilla CSS
| files. Note that this is the folder name, not the path.
| We'll stick with a general "css" name - makes sense.
|
*/
folder: 'css',
/*
|----------------------------------------------------------------
| CSS Output Folder
|----------------------------------------------------------------
|
| Generally, your source files will be stored outside of your
| public directory, and then compiled/merged as necessary.
| This property represents the public specific folder.
|
*/
outputFolder: 'css',
/*
|----------------------------------------------------------------
| CSS3 Autoprefixing
|----------------------------------------------------------------
|
| When working with any form of CSS, Elixir automatically runs
| your file through a CSS autoprefixer, which automatically
| adds or removes vendor-specific CSS3 prefixes. Useful!
|
*/
autoprefix: {
enabled: true,
// https://www.npmjs.com/package/gulp-autoprefixer#api
options: {
browsers: ['last 2 versions'],
cascade: false
}
},
/*
|----------------------------------------------------------------
| CSS3 Minification
|----------------------------------------------------------------
|
| When running Gulp with the production flag, any CSS will
| automatically be minified. This offers the benefit of
| reduced file sizes. Adjust any plugin option here.
|
*/
minifyCss: {
// https://github.com/jakubpawlowicz/clean-css#how-to-use-clean-css-api
pluginOptions: {
processImport: false
}
},
/*
|----------------------------------------------------------------
| Sass Compilation
|----------------------------------------------------------------
|
| Gone are the days of researching how to call Sass on a given
| folder. Simply run `mix.sass('file.scss')` and you're all
| set. This object sets the folder name and plugin opts.
|
*/
sass: {
folder: 'sass',
// https://github.com/sass/node-sass#options
pluginOptions: {
outputStyle: gutils.env.production
? 'compressed'
: 'nested',
precision: 10
}
},
/*
|----------------------------------------------------------------
| Less Compilation
|----------------------------------------------------------------
|
| Gone are the days of researching how to call Less on a given
| folder. Simply run `mix.less('file.less')` and you're all
| set. This object sets the folder name and plugin opts.
|
*/
less: {
folder: 'less',
// https://github.com/plus3network/gulp-less#options
pluginOptions: {}
}
},
js: {
/*
|----------------------------------------------------------------
| JavaScript Source Folder
|----------------------------------------------------------------
|
| Much like the CSS folder option above, this property sets the
| name of the folder, not the full path, for your JavaScript
| source files. It then gets affixed to the "assetsPath".
|
*/
folder: 'js',
/*
|----------------------------------------------------------------
| JavaScript Output Folder
|----------------------------------------------------------------
|
| Once your vanilla JavaScript files have been compiled/merged,
| they will be saved to your public directory. This property
| represents the name of the folder within that location.
|
*/
outputFolder: 'js',
/*
|----------------------------------------------------------------
| Babel Compilation
|----------------------------------------------------------------
|
| Think of Babel as a compiler for next-generation JavaScript.
| If you'd like to make use of ES6 - or even ES7 features -
| in new apps, we make it a cinch right from the get go.
|
*/
babel: {
// https://www.npmjs.com/package/gulp-babel#babel-options
options: {
presets: ['es2015', 'react']
}
},
/*
|----------------------------------------------------------------
| Browserify Compilation
|----------------------------------------------------------------
|
| Browserify allows you to pull in Node modules in the browser!
| Generally a pain to get up and running, Elixir offers many
| sensible defaults to get you up to speed super quickly.
|
*/
browserify: {
// https://www.npmjs.com/package/browserify#usage
options: {},
plugins: [],
externals: [],
transformers: [
{
name: 'babelify',
// https://www.npmjs.com/package/gulp-babel#babel-options
options: {
presets: ['es2015', 'react']
}
},
{
name: 'partialify',
// https://www.npmjs.com/package/partialify
options: {}
}
],
watchify: {
enabled: false,
// https://www.npmjs.com/package/watchify#usage
options: {}
}
},
/*
|----------------------------------------------------------------
| CoffeeScript Compilation
|----------------------------------------------------------------
|
| If you prefer CoffeeScript compilation, this object stores
| the defaults for the Coffee folder name - not the path.
| When used, this value will be affixed to assetsPath.
|
*/
coffee: {
folder: 'coffee',
// https://github.com/wearefractal/gulp-coffee#options
options: {}
}
},
testing: {
/*
|----------------------------------------------------------------
| PHPUnit Autotesting
|----------------------------------------------------------------
|
| Want to automatically trigger your PHPUnit tests. Not a prob!
| This object stores the defaults for the path to your tests
| folder, as well as any "gulp-phpunit" specific options.
|
*/
phpUnit: {
path: 'tests',
// https://www.npmjs.com/package/gulp-phpunit#api
options: {
debug: true,
notify: true,
configurationFile: 'phpunit.xml'
}
},
/*
|----------------------------------------------------------------
| PHPSpec Autotesting
|----------------------------------------------------------------
|
| Want to automatically trigger your PHPSpec tests. Not a prob!
| This object stores the defaults for the path to your specs
| folder, as well as any "gulp-phpspec" specific options.
|
*/
phpSpec: {
path: 'spec',
// https://www.npmjs.com/package/gulp-phpspec#api
options: {
verbose: 'v',
notify: true
}
}
},
/*
|----------------------------------------------------------------
| File Versioning
|----------------------------------------------------------------
|
| If you use aggressive assets caching on your server, then you
| will need a way to cachebust, right? No querystring needed
| this time. Here you may set the default "build" folder.
|
*/
versioning: {
buildFolder: 'build'
},
/*
|----------------------------------------------------------------
| Browsersync
|----------------------------------------------------------------
|
| Want to have your browser refresh instantly upon changing a bit
| of Sass or modifying a view? With Elixir, it has never been
| easier. This contains default options for the extension.
|
*/
browserSync: {
// http://www.browsersync.io/docs/options/
proxy: 'homestead.app',
reloadOnRestart : true,
notify: true,
},
};
/**
* Fetch a config item, using a string dot-notation.
*
* @param {string} path
* @return {string}
*/
config.get = function(path) {
var basePath;
var current = config;
var segments = path.split('.');
// If the path begins with "assets" or "public," then
// we can assume that the user wants to prefix the
// given base url to their config path. Useful!
if (segments[0] == 'assets' || segments[0] == 'public') {
basePath = config[segments.shift()+'Path'];
}
segments.forEach(function(segment) {
current = current[segment];
});
return p.join(basePath, current);
};
module.exports = config;