脚本宝典收集整理的这篇文章主要介绍了为VUE 脚手架中自定义title标签页小图标,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
效果如图所示:
index.htML
同级目录下添加favicon.ico
文件
index.html
中引入<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico" />
webpack
配置文件(build文件夹下面)在下面两个配置文件中加入:
favicon: path.resolve('./favicon.ico')
具体位置:
webpack.PRod.conf.js
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
favicon: path.resolve('./favicon.ico'),
inject: true,
}),
webpack.prod.dev.js
new HtmlWebpackPlugin({
filename: process.env.NODE_ENV === 'testing'
? 'index.html'
: config.build.index,
template: 'index.html',
favicon: path.resolve('./favicon.ico'),
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.COM/kangax/html-minifier#options-quick-reference
}
npm run dev
以上是脚本宝典为你收集整理的为VUE 脚手架中自定义title标签页小图标全部内容,希望文章能够帮你解决为VUE 脚手架中自定义title标签页小图标所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。