我有一个Angular项目应该使用名为angular-libphonenumber(https://github.com/cwill747/angular-libphonenumber)的库。
我跑:
bower install --save angular-libphonenumber
然后:
gulp install
现在gulp认为在角度本身之前注入angular-libphonenumber是个好主意:
<script src="bower_components/jquery/dist/jquery.js"></script>
...
<script src="bower_components/angular/angular.js"></script>
我如何告诉gulp这不是一个好主意并在角度后注入lib-phonenumber?
这里是inject.js:
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
inject = require('gulp-inject'),
es = require('event-stream'),
naturalSort = require('gulp-natural-sort'),
angularFilesort = require('gulp-angular-filesort'),
bowerFiles = require('main-bower-files');
var handleErrors = require('./handle-errors');
var config = require('./config');
module.exports = {
app: app,
vendor: vendor,
test: test,
troubleshoot: troubleshoot
}
function app() {
return gulp.src(config.app + 'index.html')
.pipe(inject(gulp.src(config.app + 'app/**/*.js')
.pipe(naturalSort())
.pipe(angularFilesort()), {relative: true}))
.pipe(gulp.dest(config.app));
}
function vendor() {
var stream = gulp.src(config.app + 'index.html')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(inject(gulp.src(bowerFiles(), {read: false}), {
name: 'bower',
relative: true
}))
.pipe(gulp.dest(config.app));
return stream;
}
...