In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use Linux commands to reduce js, css file size", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "how to use Linux commands to reduce the size of js, css files"!
install Java
YUI Compressor is developed by Java, so we must have Java environment first. Generally, the system will come with java, if not, then yum installs an openjava.
1
# yum install java
Confirm successful installation
1
2
3
4
[root@iZ288zwmtk4Z vhost]# java -version
java version "1.7.0_85"
OpenJDK Runtime Environment (rhel-2.6.1.3.el6_7-x86_64 u85-b01)
OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode)
Download and install YUI Compressor
1
2
# mkdir -p /usr/share/java
# wget https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar
Create script yui
1
2
3
4
# cat /usr/bin/yui
#!/ bin/sh
java -jar /usr/share/java/yuicompressor-2.4.8.jar "$@"
Give yui permission to execute
1
# chmod +x /usr/bin/yui
yui compression JS, CSS
Compress CSS command
1
# yui style.css -o style-mini.css
Compress JS file command
1
# yc jquery.js -o jquery-mini.js
If you feel that it is troublesome to compress files every time, I recommend you to use Google's pagespeed plugin, which can automatically compress files, optimize code and merge css, js, etc., which is very powerful.
At this point, I believe that we have a deeper understanding of "how to use Linux commands to reduce the size of js and css files," so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.