小程序瘦身工具

通过剔除无用文件、压缩图片、复用代码等方式减少小程序代码包体积。开源项目地址:https://github.com/wechat-miniprogram/miniprogram-slim。

安装

  1. npm install -g miniprogram-slim

使用

  1. Usage: miniprogram-slim <command>
  2. Options:
  3. -v, --version output the version number
  4. -h, --help output usage information
  5. Commands:
  6. cpd [options] <dir> Detect duplications in source code
  7. sprite [options] <input...> Covert images into css sprites
  8. imagemin [options] <input...> Minify images seamlessly
  9. analyzer [options] Analyze dependencies of miniprogram, find out unused files
  10. Examples:
  11. $ miniprogram-slim analyzer -t
  12. $ miniprogram-slim cpd src
  13. $ miniprogram-slim imagemin images/**/*.png
  14. $ miniprogram-slim sprite -f emoji images/**/*.png