Reduce the size of resources (HTML, CSS, and JavaScript)

Dec 22, 2015
PageSpeed ​​Insights
0
On this page

This rule is triggered when PageSpeed Insights detects that one of your resources can be reduced in size by a reduction operation.

Overview

Reducing resource size means removing unnecessary bytes (for example, redundant spaces, newlines, and indentation). Compressing HTML, CSS, and JavaScript improves download, parsing, and execution speed. In addition, for CSS and JavaScript, you can further reduce the file size by renaming the variable name during the appropriate update to the HTML to ensure that the selector continues to run.

Recommendations

You should reduce the size of HTML, CSS, and JavaScript.

要缩减HTML的大小,您可以使用PageSpeed Insights Chrome ExtensionsTo generate the optimized HTML code. Analyze the HTML page, and then browse the "Reduce HTML Size" rule. Click View Optimized Content to get the optimized HTML code.

要缩减CSS的大小,您可以尝试使用YUI Compressorcssmin.js.

To reduce the size of JavaScript, try using theClosure CompilerJSMinOrYUI Compressor. You can create a build process that uses these tools to reduce the size of the development file, rename it, and then save it to the official version directory.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. For details, see ourSite Policies.


Articles
PageSpeed ​​Insights
Back to List
Nickname*:
E-mail*:
Rate*:
Comments*:

If you need to get in touch with us, here are our contact details

If you need to get in touch with us, here are our contact details
联系电话
联系邮箱
微信联系
杰赢网络
QQ
215168