我使用gulp compilator进行角度调整。我使用了凉亭依赖,我将所有这些都移到了npm。我有注入脚本依赖的问题。这是我目前的注射代码。如何将wiredep更改为另一个库以处理npm注入,因为我有未捕获的ReferenceError:未定义angular并且var angular = require(angular)不起作用。是否有任何简单的解决方案在没有要求的情况下将npm依赖注入脚本?如果没有要求怎么做?
var injectStyles = gulp.src([
paths.tmp + '/serve/{app,components,lib}/**/*.css',
paths.src + '/{app,components,lib}/**/*.css',
'!' + paths.tmp + '/serve/app/vendor.css'
], {read: false});
var injectScripts = gulp.src([
paths.src + '/{app,components,lib}/**/*.js',
paths.tmp + '/serve/build/*.js',
'!' + paths.src + '/{app,components}/**/*.spec.js',
'!' + paths.src + '/{app,components}/**/*.mock.js'
]).pipe($.angularFilesort());
var injectOptions = {
ignorePath: [paths.src, paths.tmp + '/serve', paths.tmp + '/build'],
addRootSlash: false
};
var wiredepOptions = {
directory: 'bower_components',
exclude: [/bootstrap\.css/, /bootstrap\.css/, /foundation\.css/]
};
return gulp.src(paths.src + '/*.html')
.pipe($.inject(injectStyles, injectOptions))
.pipe($.inject(injectScripts, injectOptions))
.pipe(gulp.dest(paths.tmp + '/serve'));