1. Installation
npm install font-spider -g
2. Check the version: font-spider -v
shows a version number which means success
3. Because the file suffix produced by the vue packaging project will generate dynamic characters, so we create a new index.html in the folder where the font is stored, import the font file, and the word spider will automatically detect it for us
4. CMD enters the font folder, and input the command font-spider index.html
5. Successful, the size of the font before and after the comparison
has changed from 10m to 2k, and the optimization is extremely high
6. Now, the volume
of 21m before and after packaging has become 6m (three font files have been optimized in my project, because this is a tutorial, so I only wrote one in the index.html code for everyone to view)
Summary: There are three ways to optimize the package size of the vue project
1. Do not generate map files, tutorial
file links 2. Compress font files
3. Turn on gzip compression (this needs to be done together with the back-end, the first two can be optimized separately for the front-end)