Merge css and js files to speed up website browsing

Source: Internet
Author: User

Although the home pages and independent article pages on this site are all static, the response speed may be a little unbearable because servers are deployed in DH in the United States. I searched a lot of articles on Wp Optimization on the Internet. Here I recommend a collection of optimizations: The ultimate Wordpress-wp optimization manual. I have read this article for a long time, but I have never been too lazy to start it.

I checked the source files on the Ks Home page and found that there are many html statements loaded into js and css files. That is to say, when the system displays the homepage, it will read these files. At this time, a large number of http requests will be generated, with a latency of about 0.2 S/time, this will greatly reduce the reading speed!

Therefore, the css and js files in the wp plug-in are mainly merged today, but I didn't use the method of manual merge in the reading hall to create a new all. js. php method. For css files, I merge them manually. I simply copy the patterns in several css files to theme's style.css, delete the corresponding css files, and delete the corresponding php statements that call the css file in the plug-in. For processing js files, I first create an all. and copy all the js Code called by the plug-in to all. js, then delete the corresponding js file and the php statement that calls the js file, upload all. js to the appropriate location, and finally in head. add and load all. js statement. This method can be modified and deleted in many places, and is prone to errors. Therefore, back up data before modification or deletion!

The effect is quite obvious. I tested it with PingDom. Compared with the previous data, the time is indeed quite different. In fact, I felt like it was faster. I also asked alicloud and S to help me test it. They all said the access speed was improved. It's good to be effective. Time is not in vain! I would like to thank my brother afei for his many tests. Haha ~~~

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.