0

我正在使用wiredep 注入脚本,但我不希望jquery 被注入。我正在使用wiredep exclude 选项来排除jquery,但它确实被注入了。如何排除 jquery 被wiredep 注入。下面是 bower.json

{
  "name": "people10-code-challenge",
  "description": "People10 Code Challenge",
  "main": "app.js",
  "authors": [
    "Mahtab Alam"
  ],
  "license": "MIT",
  "keywords": [
    "nodejs",
    "angularjs",
    "mongodb",
    "express"
  ],
  "homepage": "https://github.com/eMahtab/people10-code-challenge",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "app/client/vendor",
    "test",
    "tests"
  ],
  "dependencies": {
    "angular": "1.6.4",
    "bootstrap-additions": "^0.3.1",
    "AngularJS-Toaster": "angularjs-toaster#^2.1.0",
    "bootstrap": "^3.3.7",
    "angular-strap": "^2.3.12"
  }
}

这是 gulpfile.js

"use strict"

var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    stylish = require('jshint-stylish'),
    wiredep = require('wiredep').stream,
    paths = {
        js:['./app/client/js/**/*.js','./app/client/app.js','./app/server/**/*.js']
    };

gulp.task('jshint',function(){
    return gulp.src(paths.js)
           .pipe(jshint())
           .pipe(jshint.reporter(stylish));
})    


var wiredepOptions = {  
  directory: 'app/client/public/vendor',
  exclude: ['jquery']
};


// Inject Bower components
gulp.task('wiredep', function () {

    gulp.src(['app/client/public/index.html'])
        .pipe(wiredep({wiredepOptions}))
        .pipe(gulp.dest('build'));    
});
4

1 回答 1

0

明白了,wiredepOptions 已经是一个对象,我将它包装在一个对象中。只是直接传递了wiredepOptions对象,它就起作用了。我的错。

于 2017-06-13T10:44:21.293 回答