forked from sumocoders/Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulp-travis.js
52 lines (46 loc) · 1.36 KB
/
gulp-travis.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
var gulp = require('gulp'),
gutil = require('gulp-util'),
rename = require('gulp-rename'),
coffee = require('gulp-coffee'),
stripPath = require('./gulp-helpers/strip-path');
var config = {
temporaryDir: './assets',
assetsDir: './web/assets'
};
gulp.task('coffee', function() {
gulp.src(
[
'./src/**/Resources/assets/coffee/***.coffee',
'./vendor/sumocoders/**/Resources/assets/coffee/***.coffee'
]
)
.pipe(coffee({}).on('error', gutil.log))
.pipe(rename(function(path) {
var end = path.dirname.indexOf('Bundle') + 6;
var start = path.dirname.substr(0, end).lastIndexOf('/') + 1;
var bundle = path.dirname.substr(start, end - start);
path.dirname = '';
path.basename = bundle.toLowerCase() + '.' + path.basename;
}))
.pipe(gulp.dest(config.assetsDir + '/js'));
});
gulp.task('js', function() {
gulp.src(
[
'./src/**/Resources/assets/js/**',
'./vendor/sumocoders/**/Resources/assets/js/**'
]
)
.pipe(rename(function(path) {
if (path.extname === '') {
path.dirname = '';
path.basename = '';
return;
}
path.dirname = stripPath('/js/', path.dirname);
}))
.pipe(gulp.dest(config.assetsDir + '/js'));
});
gulp.task('build', function() {
gulp.start('coffee', 'js');
});