Nodejs static files: Using Nodejs to compress js,css static resources

Source: Internet
Author: User
Tags min variable

1.[js compression]uglifyjs Source.js-mc-o target.min.js
To compress Angular.js as an example, can compress local variable name, remove useless local variable, blank character, etc., compression ratio is close to 80%, the efficiency is good
[User_00@localhost ~]$ uglifyjs angular.js-mc-o angular.min.js
warn:dropping unused function Isboolean [angular.js:416,9]
warn:dropping unused function Makemap [angular.js:446,9]
warn:dropping unused function size [angular.js:488,9]
warn:dropping unused function Isleafnode [angular.js:523,9]
warn:dropping unused function Argument Boundtranscludefn [angular.js:4682,27]
warn:dropping unused function Argument rootelement [angular.js:4681,16]
warn:dropping unused function Argument nodelist [angular.js:4680,17]
warn:dropping unused function argument scope [angular.js:4679,22]
warn:dropping unused function NODESETLINKINGFN [angular.js:4678,9]
warn:dropping unused function Argument Boundtranscludefn [angular.js:4690,27]
warn:dropping unused function Argument rootelement [angular.js:4689,16]
warn:dropping unused function Argument node [angular.js:4688,13]
warn:dropping unused function argument scope [angular.js:4687,22]
warn:dropping unused function Argument NODESETLINKINGFN [angular.js:4686,25]
warn:dropping unused function DIRECTIVELINKINGFN [angular.js:4685,9]
warn:dropping unused function Striphash [angular.js:5009,9]
warn:dropping unused variable ng_switch [angular.js:13857,4]
warn:dropping unused variable FNS [angular.js:1536,8]
warn:dropping unused variable events [angular.js:1536,13]
warn:dropping unused function Wrongmode [angular.js:3879,13]
warn:dropping unused function argument cause [angular.js:4799,31]
warn:dropping unused function argument exception [angular.js:4799,20]
warn:dropping unused function argument args [angular.js:8165,28]
warn:dropping unused function argument args [angular.js:8231,33]
warn:dropping unused function argument names [angular.js:9018,32]
warn:dropping unused function argument name [angular.js:9030,40]
warn:dropping unused variable value [angular.js:9230,14]
warn:dropping unused function argument value [angular.js:12475,36]
[User_00@localhost ~]$ Ls-lh angular.*
-rw-rw-r--1 user_00 user_00 479K Apr 5 01:53 angular.js
-rw-rw-r--1 user_00 user_00 79K May 4 16:09 angular.min.js
2.[CSS compression]sqwish Style.css–strict
Sqwish now appears to be a low compression ratio.
[User_00@localhost ~]$ sqwish style.css--strict
[User_00@localhost ~]$ Ls-lh style.*
-rw-rw-r--1 user_00 user_00 5.8K Dec 10:40 style.css
-rw-rw-r--1 user_00 user_00 5.5K May 4 16:14 style.min.css
3. To be continued--Picture compression tool
This article links http://www.cxybl.com/html/wyzz/CSS/20130830/39955.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.