简体   繁体   English

我无法使用wiredep注入bower软件包,并且没有错误?

[英]I can't inject bower packages with wiredep and no error?

I am trying to inject bower packages to html using wiredep, but it's not injected and no error appear 我正在尝试使用wiredep将Bower软件包注入html,但是没有注入并且没有出现错误

this is my gulpfile.js: 这是我的gulpfile.js:

gulp.task('inject', function () {

    var wiredep = require('wiredep').stream;
    var options = {
        bowerJson: require('./bower.json'), //it will return back that json object 
        directory: './public/lib' //where to look for 
    }
    return gulp.src('./src/views/*.html')
        .pipe(wiredep(options))
        .pipe(gulp.dest('./src/views')); // pipe that back into our views directory
});

and this is the index.html 这是index.html

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <title>Storystrap Template</title>
        <meta name="generator" content="Bootply" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
        <!--[if lt IE 9]>
            <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    <link href="css/styles.css" rel="stylesheet">
    <!-- bower:js -->
    <!-- endbower -->
    </head>

It won't work when we try to inject css files with versions after "bootstrap": "3.3.4" 当我们尝试注入“ bootstrap”之后的版本为“ 3.3.4”的css文件时,它将无法正常工作

so I dealt with it by overriding the bower packages that I am trying to inject in my bower.json file here is the code: 所以我通过覆盖要尝试在bower.json文件中插入的bower包来处理它,这是代码:

"overrides": {
    "bootstrap": {
      "main": [
        "dist/js/bootstrap.js",
        "dist/css/bootstrap.css",
        "less/bootstrap.less"
      ]
    },
    "font-awesome": {
      "main": [
        "less/font-awesome.less",
        "css/font-awesome.min.css",
        "scss/font-awesome.scss"
      ]
    }
  }

hope that was helpful thanks. 希望对您有所帮助,谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM