forked from laravel/elixir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
46 lines (35 loc) · 1.38 KB
/
scripts.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
var elixir = require('laravel-elixir');
var combine = require('./commands/MergeFiles.js');
var MergeRequest = require('./commands/MergeRequest');
/*
|----------------------------------------------------------------
| JavaScript File Concatenation
|----------------------------------------------------------------
|
| This task will concatenate and minify your JavaScript files
| in order. This provides a quick and simple way to reduce
| the number of HTTP requests your application executes.
|
*/
elixir.extend('scripts', function(scripts, outputDir, baseDir) {
outputDir = outputDir || elixir.config.jsOutput;
return combine(mergeRequest(scripts, outputDir, baseDir));
});
elixir.extend('scriptsIn', function(baseDir, outputDir) {
outputDir = outputDir || baseDir;
return combine(mergeRequest('**/*.js', outputDir, baseDir));
});
elixir.extend('babel', function(scripts, outputDir, baseDir, options) {
outputDir = outputDir || elixir.config.jsOutput;
options = options || elixir.config.babelOptions;
return combine(mergeRequest(scripts, outputDir, baseDir, options));
});
var mergeRequest = function(scripts, outputDir, baseDir, babel) {
var request = new MergeRequest(scripts, baseDir, outputDir, 'js');
request.taskName = 'scripts';
request.minifier = require('gulp-uglify');
if (babel) {
request.babel = babel;
}
return request;
};