通过剔除无用文件、压缩图片、复用代码等方式减少小程序代码包体积。开源项目地址:https://github.com/wechat-miniprogram/miniprogram-slim。
npm install -g miniprogram-slim
Usage: miniprogram-slim <command>
Options:
-v, --version output the version number
-h, --help output usage information
Commands:
cpd [options] <dir> Detect duplications in source code
sprite [options] <input...> Covert images into css sprites
imagemin [options] <input...> Minify images seamlessly
analyzer [options] Analyze dependencies of miniprogram, find out unused files
Examples:
$ miniprogram-slim analyzer -t
$ miniprogram-slim cpd src
$ miniprogram-slim imagemin images/**/*.png
$ miniprogram-slim sprite -f emoji images/**/*.png
© 2023 mianshi8.net MIT license