ionic3 压缩

minify

https://www.npmjs.com/package/ionic-minify

https://github.com/Kurtz1993/ionic-minify/blob/master/lib/IonicMinifyConfigurations.d.ts#L92

https://github.com/Kurtz1993/ionic-minify/blob/master/lib/IonicMinifyConfigurations.d.ts#L92

 

 

cnpm install ionic-minify --save-dev

cnpm run ionic:build --prod

package.json

"scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "minify": "ionic-app-scripts minify",
    "uglify-js": "git+https://github.com/mishoo/UglifyJS2.git#harmony"
  },

 minify-conf.json

{
    "foldersToProcess": [
      "js",
      "css",
      "img"
    ],
    "jpgOptions":{
      "quality": 50
    },
    "jsOptions": {
      "compress": {
        "drop_console": true
      }
    },
    "cssOptions": {
      "keepSpecialComments": 0
    },
    "alwaysRun": false,
    "showErrStack": false
}
cnpm install ionic-minify --save-dev
E:\01.code\git\ionic\myapp>cnpm install ionic-minify --save-dev
√ Installed 1 packages
√ Linked 234 latest versions
  √ mozjpeg pre-build test passed successfully
  √ pngout pre-build test passed successfully

Creating directory: E:\01.code\git\ionic\myapp\hooks\after_prepare
Copying minifier file to project's hooks/after_prepare...
Copying configuration file to project's hooks/ folder...
Updating hooks directory to have execution permissions...
It appears that you have already installed chalk...
It appears that you have already installed clean-css...
It appears that you have already installed mozjpeg-stream...
It appears that you have already installed ng-annotate...
It appears that you have already installed pngout-bin...
It appears that you have already installed shelljs...
It appears that you have already installed uglify-js...
Ionic minify has been installed successfully! :)
√ Run 4 scripts
deprecate ionic-minify@2.0.10 › pngout-bin@2.0.1 › bin-wrapper@2.1.3 › globby@1.2.0 › glob@4.5.3 › minimatch@^2.0.1 Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
deprecate ionic-minify@2.0.10 › pngout-bin@2.0.1 › bin-wrapper@2.1.3 › download@3.3.0 › vinyl-fs@0.3.14 › glob-watcher@0.0.6 › gaze@0.5.2 › globule@0.1.0 › minimatch@~0.2.11 Please update to mini
match 3.0.2 or higher to avoid a RegExp DoS issue
deprecate ionic-minify@2.0.10 › pngout-bin@2.0.1 › bin-wrapper@2.1.3 › download@3.3.0 › vinyl-fs@0.3.14 › glob-watcher@0.0.6 › gaze@0.5.2 › globule@0.1.0 › glob@3.1.21 › graceful-fs@~1.2.0 gracef
ul-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
Recently updated (since 2017-07-26): 5 packages (detail see file E:\01.code\git\ionic\myapp\node_modules\.recently_updates.txt)
  Today:
    → ionic-minify@2.0.10 › mozjpeg-stream@1.0.2 › mozjpeg@4.1.1 › bin-wrapper@3.0.2 › download@4.4.3 › vinyl-fs@2.4.4 › duplexify@^3.2.0(3.5.1) (04:44:06)
√ All packages installed (215 packages installed from npm registry, used 11s, speed 102.92kB/s, json 235(330.75kB), tarball 850.62kB)

E:\01.code\git\ionic\myapp>
E:\01.code\git\ionic\myapp>
E:\01.code\git\ionic\myapp>


cnpm run ionic:build --prod

E:\01.code\git\ionic\myapp>cnpm run ionic:build --prod

> myapp@0.0.1 ionic:build E:\01.code\git\ionic\myapp
> ionic-app-scripts build

[11:21:09]  ionic-app-scripts 2.1.0
[11:21:09]  build prod started ...
[11:21:09]  clean started ...
[11:21:09]  clean finished in less than 1 ms
[11:21:09]  copy started ...
[11:21:09]  ngc started ...
[11:21:19]  ngc finished in 9.71 s
[11:21:19]  preprocess started ...
[11:21:19]  deeplinks started ...
[11:21:19]  deeplinks finished in 344 ms
[11:21:19]  optimization started ...
[11:21:20]  copy finished in 10.47 s
[11:21:29]  optimization finished in 10.37 s
[11:21:29]  preprocess finished in 10.71 s
[11:21:29]  webpack started ...
[11:21:58]  webpack finished in 28.59 s
[11:21:58]  sass started ...
[11:21:58]  webpack started ...
[11:21:58]  uglifyjs started ...
[11:22:28]  uglifyjs finished in 29.45 s
[11:22:28]  webpack finished in 29.78 s
[11:22:28]  sass finished in 29.94 s
[11:22:28]  cleancss started ...
[11:22:29]  cleancss finished in 515 ms
[11:22:29]  postprocess started ...
[11:22:29]  postprocess finished in 6 ms
[11:22:29]  lint started ...
[11:22:29]  build prod finished in 79.51 s

 

转载于:https://my.oschina.net/yizhichao/blog/1499372

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值