forked from Cuevana/storm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (48 loc) · 1.44 KB
/
gulpfile.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
var gulp = require('gulp'),
less = require('gulp-less'),
concat = require('gulp-concat'),
inject = require("gulp-inject");
var basePath = './app/assets/';
var paths = {
less: basePath+'less/',
css: basePath+'css/',
scripts: basePath+'js/',
appScripts: './app/js/',
views: './app/views/'
};
// Inyectar referencias al HTML
gulp.task('inject-index', ['styles'], function() {
return gulp.src(paths.views+'index.html')
.pipe(inject(gulp.src([
paths.css+'*.css',
paths.scripts+'*.js',
paths.appScripts+'*.js',
'!'+paths.appScripts+'player.js'
], {read:false})))
.pipe(gulp.dest(paths.views));
})
gulp.task('inject-player', ['styles'], function() {
return gulp.src(paths.views+'player.html')
.pipe(inject(gulp.src([
paths.css+'*.css',
paths.scripts+'*.js',
paths.appScripts+'localization.js',
paths.appScripts+'player.js'
], {read:false})))
.pipe(gulp.dest(paths.views));
})
// Compilar Less
gulp.task('styles', function() {
return gulp.src(paths.less+'default.less')
.pipe(less())
.pipe(concat('less.css'))
.pipe(gulp.dest(paths.css))
});
// Watch
gulp.task('watch', function() {
gulp.watch( paths.less+'**/*.less', ['inject-index', 'inject-player']);
gulp.watch( paths.scripts+'**/*.js', ['inject-index', 'inject-player']);
gulp.watch( paths.appScripts+'*.js', ['inject-index', 'inject-player']);
})
// Default (inicia sequencia)
gulp.task('default', ['inject-index', 'inject-player', 'watch']);