簡體   English   中英

我無法使用wiredep注入bower軟件包,並且沒有錯誤?

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

我正在嘗試使用wiredep將Bower軟件包注入html,但是沒有注入並且沒有出現錯誤

這是我的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
});

這是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>

當我們嘗試注入“ bootstrap”之后的版本為“ 3.3.4”的css文件時,它將無法正常工作

所以我通過覆蓋要嘗試在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"
      ]
    }
  }

希望對您有所幫助,謝謝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM