webpack reference to third-party icon, using the template template package

1, download IconFont: https://iconfont.imweb.io/

I just got a few this site, directly into the app project after unzip the file, as shown at right: (zoom).

2, select the icon preview html file, shortcut keys ctrl + shift + c, in the browser preview are normal

3, corresponding to webpack.config.js modify configuration information, shown to the right: (zoom).

If properly display the browser from the path above the beginning of the app copy:

plugins: [
		new HtmlWebpackPlugin({
			"filename": 'iconIndex.html',/* 会根据demo_fontclass.html模板,生成到public目录下,同时也会引用icon.js */
			"template": __dirname + "/app/css/iconfont/demo.html"/* 别忘记是/app开头,我写成了app开头报错了 */
		}),
		new ExtractTextPlugin('[name].css'),
		new CopyWebpackPlugin([{
			from: __dirname + "/app/css",
			to: "./css"
		}]),
		new CleanWebpackPlugin(),
	],

4, performing a packing command

webpack

 

Published 237 original articles · won praise 52 · Views 150,000 +

Guess you like

Origin blog.csdn.net/Sicily_winner/article/details/104102304