gulp wiredep- ignorePath不工作

时间:2016-03-03 04:15:18

标签: gulp bower wiredep

我的.bowerrc有"directory": "./public/bower_components/"

我成功注入了html,但是我收到了不需要的路径前缀'../../ public /':

<script src="../../public/bower_components/jquery/dist/jquery.js"></script>
<script src="../../public/bower_components/underscore/underscore.js"></script>
<script src="../../public/bower_components/angular/angular.js"></script>
<script src="../../public/bower_components/typeahead.js/dist/typeahead.bundle.js"></script>
<script src="../../public/bower_components/angular-file-upload-shim/angular-file-upload-shim.js"></script>
<script src="../../public/bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="../../public/bower_components/angular-animate/angular-animate.js"></script>

我的gulp任务看起来像这样:

gulp.task('wiredep', function() {
   var options = config.getWiredepDefaultOptions();
   var wiredep = require('wiredep').stream;

   return gulp
         .src(config.index)
         .pipe(wiredep(options))
         .pipe($.inject(gulp.src(config.clientjs), {ignorePath: '/public/'}))
         .pipe(gulp.dest('./build/'));
});

我的wiredep选项如下所示:

  bowerJson: require('./bower.json'),
  directory: './public/bower_components/',
  ignorePath: '../../public/'

根据wiredep docs,它有一个ignorePath选项属性,我可以传递,将从注入的路径中忽略。我无法找出似乎是什么问题。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我的gulp.config.js中有拼写错误,导致我的选项无法正确加载