Wiredep only include specific files

310 views Asked by At

I need to pull from a large list of files in my bower_components folder and only select a few (this is for a tester .html file secondary to the index.html. Does wiredep have this option? I know I can use the exclude property in the options, however aside from trying to figure out a work-around, using this option, I can't seem to find anything direct.

Below are the two attempts I've made:

  • I took a wild guess using the src attribute, since I can't really find any info about this in the documentation. This didn't have any effect on the wiredep output.

  • I also attempted another guess with the exclude syntax... again no effect.

Example

gulp.task("example", function(){
    var wiredepOptions = config.getWiredepOptions();

return gulp.src(config.sourceFile)
           .pipe(wiredepStream(wiredepOptions))
});

config.getWiredepOptions = function(){
    var options = {
        bowerJson: config.bower.json,
        directory: config.bower.directory,
        ignorePath: config.bower.ignorePath,
        src: ['jquery.js'],                 // I've used either this option...
        exclude: ['!jquery.js'] ,           // ...or this one. Never both at same time.
        fileTypes: {
            html:{
                block: /(([ \t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi,
                detect: {
                    js: /<script.*src=['"]([^'"]+)/gi,
                    css: /<link.*href=['"]([^'"]+)/gi
                },
                replace: {
                    js: '<script src="./../..{{filePath}}"></script>',
                    css: '<link rel="stylesheet" href="./../..{{filePath}}"></script>'
                }
            }
        }  
    };
    return options;
};
0

There are 0 answers