Ionic: How to uglify and minify my code before release?

删除回忆录丶 提交于 2019-12-14 01:25:42

问题


I am getting ready to release my first app build in ionic. I am interested in how I can minify and uglify my code? Are there any plugins for that?

Thanks
uksz


回答1:


There is an automated task runner for JavaScript called Gulp ( gulp.js ). It has packages like:

  • gulp-minify-css and gulp-uglify

Hope it helps.




回答2:


Running ionic build --prod did the trick for me. I am using ionic to deploy my app as a website.




回答3:


Using ionic cordova build <platform> --prod --release will create you a release version of the app with the code uglyfied and minified.

Also running a simple ionic cordova build <platform> will also do the job. The minified and uglyfied js is located on the www folder as main.js

Take in count that what minifies and uglyfies the source code is ionic-app-scripts.



来源:https://stackoverflow.com/questions/33674158/ionic-how-to-uglify-and-minify-my-code-before-release

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!