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。

  • 相关阅读:
    Wireshark下载地址
    WireShark过滤语法
    Centos7 虚拟机安装增强功能
    更改切换热键
    kali安装后中文乱码
    C#中关于WebBrowser的一些细节设置
    方法间多参数传递
    绑定checkedComboBox
    反射方法调用例子
    gridView 删除一行后自动定位到指定行
  • 原文地址:https://www.cnblogs.com/linfblog/p/12123071.html
Copyright © 2011-2022 走看看