inject.js
1021 Bytes
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
'use strict';
var gulp = require('gulp');
var paths = gulp.paths;
var $ = require('gulp-load-plugins')();
var wiredep = require('wiredep').stream;
gulp.task('inject', ['styles'], function () {
var injectStyles = gulp.src([
paths.tmp + '/serve/{app,components}/**/*.css',
'!' + paths.tmp + '/serve/app/vendor.css'
], { read: false });
var injectScripts = gulp.src([
paths.src + '/{app,components}/**/*.js',
'!' + paths.src + '/{app,components}/**/*.spec.js',
'!' + paths.src + '/{app,components}/**/*.mock.js'
]).pipe($.angularFilesort());
var injectOptions = {
ignorePath: [paths.src, paths.tmp + '/serve'],
addRootSlash: false
};
var wiredepOptions = {
directory: 'bower_components',
exclude: [/bootstrap\.css/, /foundation\.css/]
};
return gulp.src(paths.src + '/*.html')
.pipe($.inject(injectStyles, injectOptions))
.pipe($.inject(injectScripts, injectOptions))
.pipe(wiredep(wiredepOptions))
.pipe(gulp.dest(paths.tmp + '/serve'));
});