YUI Compressor is a tool used to compress JS and CSS files. It is developed in Java. Recently compressed files often use online compression to compress files, which is inconvenient, and can only be shelved if there is no network. This article describes how to use the YUI Compressor plug-in Sbulime text2.
Java installation
Download and Install java on the official website. After installation, configure environment variables:
1. My computer-> right-click Properties-> Advanced System Settings-> Advanced-> environment variables-> System variables:
(1) create-> variable name: JAVA_HOME variable value: C: \ Program Files \ Java (my JDK installation path)
(2) Edit-> variable name: Path to add % JAVA_HOME % \ bin at the beginning of the variable value; % JAVA_HOME % \ jre \ bin
(3) Create-> variable name: CLASSPATH variable value :.; % JAVA_HOME % \ lib; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar to test whether the environment variables are set successfully:
Cd: \ Users \ zuojj \ javac usage: javac <options> <source files> where possible options include-g to generate all debugging information-g: none does not generate any debugging information-g: {lines, vars, source} only generate some debugging information.-nowarn does not generate any warning.-verbose outputs the deprecation of the operations being executed by the compiler.-classpath <path> specifies the process for searching User-Class files and comments
If the preceding result is displayed, the installation is successful.
YUI Compresso plug-in installation
Use Sublime text2 for installation. No more details!
Code compression
After the plug-in is installed, go to the Sublime text2 menu bar-> Tools-> Build System-> select YUI Compressor-> open the CSS or JS file to be compressed (such as a.css) -> (Tools-> Build or Ctrl + B)-> generate the.min.css file in the.css Directory-> compress the file.
Recommended Online (variable) compression and anti-compression tools
1. JS online (variable) compression tool
2. JS online (variable) anti-compression tool
Reprinted statement:
Title: YUI Compressor for Sublime text2
Link to this article: http://www.zuojj.com/archives/1059.html.
YUI Compressor for Sublime text2