Gulp wiredep excluding jquery from being injected

280 views Asked by At

I'm using wiredep to inject the scripts but I don't want jquery being injected. I'm using wiredep exclude option to exclude jquery but it does get injected. How can I exclude jquery from being injected by wiredep. Below is the 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"
  }
}

here is the 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'));    
});
1

There are 1 answers

0
Mahtab Alam On

Got it , wiredepOptions is already an object I was wrapping it inside an object. Just passed the wiredepOptions object directly, it worked. My bad.