Minify Resources (HTML, CSS, and JavaScript)

 Coding Standards     Google Developers     Updated on Sep 11, 2014     VIKRAM     286   

This rules triggers when PageSpeed Insights detects that the size of one of your resources could be reduced through minification.

Overview

Minification refers to the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser - e.g. code comments and formatting, removing unused code, using shorter variable and function names, and so on. See preprocessing & context-specific optimizations to learn more.

Recommendations

You should minify your HTML, CSS, and JavaScript resources. For minifying HTML, you can use PageSpeed Insights Chrome Extension to generate an optimized version of your HTML code. Run the analysis against your HTML page and browse to the 'Minify HTML' rule. Click on 'See optimized content' to get the optimized HTML code. For minifying CSS, you can try YUI Compressor and cssmin.js. For minifying JavaScript, try the Closure CompilerJSMin or the YUI Compressor. You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.

  Related Articles
  Recent Articles