Overview
In the use of HTML5 development Hybird app, may introduce a large number of JS package, in addition to some of the core JS files, some special processing,
such as compression and encryption is very important, YUI compressor is such a tool for compressing JS, CSS (cover face: Actually I use it to the code
Compression as a means of obfuscation), is developed in Java, so the runtime needs to install the Java environment First, after installation, shipped
Both the line and the configuration are relatively simple.
Installation and use
Before using Yui compressor, you must first configure the Java environment, how to configure this is not said.
YUI Compressor:
Https://github.com/yui/yuicompressor/releases
After the download, what we really need is this Yuicompressor-[version].jar file
Open cmd, enter the following command to compress the required JS file
java -jar D:\yuicompressor-2.4.6\build\yuicompressor-2.4.6.jar --type js --charset UTF-8 D:\my.js -o D:\my-min.js
<textarea spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none" tabindex="0" readonly=""></textarea>1 1
Java -Jar D:\Yuicompressor-2.4.6\Build\Yuicompressor-2.4.6. Jar --type JS --CharSet UTF-8 D:\my. js -o D:\my-min. js
Parameter description:
D:\yuicompressor-2.4.6\build\yuicompressor-2.4.6.jar: The path that represents Yuicompressor
D:\my.js: The path of the JS file that needs to be compressed
D:\my-min.js: The JS path after compression
Note: If there is debugger in the JS file, this breakpoint will need to be deleted, otherwise the compression fails, 2.4.7 is the version.
From for notes (Wiz)
"JS code compression" Using Yui compressor to the JS file compression processing