Introduction/infoautocompressimgbytinypngwhenusedwebpackorvue这个插件可以记录压缩,如果文件没有更新不会重新压缩vue和webpack的tinypng插件支持调整图片大小,可以根据资源判断资源是否发生变化记录。npm地址不变时不会重复压缩使用/howtousesetkey/setkey1.createtinypng.jspath:{yourworkspace}/tinypng.jstinypng.js:module.exports={key:"XXXX",};2.在options.config中设置keynewtinypngPlugin({config:{key:"XXXX",}})import/importwebpackmodule.exports={plugins:[newtinypngPlugin()]};vueconfigureWebpack:(config)=>{return{plugins:[newtinypngPlugin()]}}配置属性/optionsoption.configName配置文件名,无后缀默认"tinypng"配置文件名默认为"tinypng"configName:""option.cachePathcachepathdefault".tinypng"压缩记录缓存路径默认为".tinypng",以根目录为准""option.regcompressimgregdefault:/.(png|jpe?g|bmp)/i需要压缩资源后缀的正数然后查看默认:/.(png|jpe?g|bmp)/ireg:XXXXoption.usetrue/false运行这个插件default:true是否启动插件default:trueuse:true/false,option.cache是??否记录压缩缓存default:true是否启用缓存记录默认值:truecache:true/false,option.configoption.config.keyyourkeytinypng'skeykey:XXX,option.config.methodresizemethodscale/fit/cover/thumblook图片调整模式支持:scale/fit/cover/thumb详细方法:""option.config.widthresizeassetwidth调整图片width:""option.config.heightresizeassetheight调整图片height:""
