zoukankan      html  css  js  c++  java
  • vue中添加favicon.ico

    在vue路由模式中添加favicon.ico语普通页面不同,仅仅在header中添加是没有效果的。

    1、首先将favicon.ico图片放在根目录下

    2、修改webpack配置文件
    (1)找到build下的webpack.dev.conf.js文件

    在plugins:[]下加入:

        new HtmlWebpackPlugin({
          filename: 'index.html',
          template: 'index.html',
          inject: true,
          favicon: path.resolve('favicon.ico')
        }),


    (2)找到build下的webpack.prod.conf.js文件

    同样的在在plugins:[]下加入:

    new HtmlWebpackPlugin({
          filename: process.env.NODE_ENV === 'testing'
            ? 'index.html'
            : config.build.index,
          template: 'index.html',
          inject: true,
          favicon: path.resolve('favicon.ico'),
          minify: {
            removeComments: true,
            collapseWhitespace: true,
            removeAttributeQuotes: true
            // more options:
            // https://github.com/kangax/html-minifier#options-quick-reference
          },
          // necessary to consistently work with multiple chunks via CommonsChunkPlugin
          chunksSortMode: 'dependency'
        }),


    修改配置文件后需重启npm run dev ,

    打包后,可以看到根目录下多了一个网页icon。

  • 相关阅读:
    图书排列
    L1-059 敲笨钟 (20 分)
    区间移位
    取球博弈
    poj 2456 Aggressive cows
    对局匹配
    发现环
    数字划分
    哥德巴赫分解
    把数组排成最小的数
  • 原文地址:https://www.cnblogs.com/linfblog/p/12123071.html
Copyright © 2011-2022 走看看