gulp wiredep- ignorePath不工作(gulp wiredep- ignorePath not working)

我的.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文档 ,它有一个我可以传递的ignorePath options属性,它将被注入的路径忽略。 我无法找出似乎是什么问题。 有任何想法吗?

My .bowerrc has this "directory": "./public/bower_components/"

I am successfully injecting html, but I am getting unwanted path prefix, '../../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>

My gulp task looks like this:

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/')); });

My wiredep options look like this:

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

According to the wiredep docs, it has an ignorePath options property that I can pass that will be ignored from the injected path. I can't find out what seems to be the problem. Any ideas?

最满意答案

我的gulp.config.js中有一个拼写错误,所以我的选项没有正确加载

Had a typo in my gulp.config.js so that my options weren't loading correctly

更多推荐