Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.Minify is designed to improve the website performance.
This module provides the mechanism to render the page using minified version of HTML and JavaScript files.
Minified HTML is generated using regular expression, and JavaScript files are generated using GOOGLE Closure Compiler webservice. Minify also works perfectly with Boost module.
How Minify help
Minify removes the comments and whitespace which will help to reduce the file size. Smaller HTML and file size reduces the page load time and improve the website performance.
What is HTML Minify
It will remove all white spaces before and after HTML tags and unnecessary line breaks.
Before Minify
<div class="content">
<div class="block">BLOCK</div>
<div class="block">BLOCK</div>
<div class="block">BLOCK</div>
<div class="block">BLOCK</div>
<div class="block">BLOCK</div>
</div>
After Minify
<div class="content"><div class="block">BLOCK</div><div class="block">BLOCK</div><div class="block">BLOCK</div><div class="block">BLOCK</div><div class="block">BLOCK</div></div>
JavaScript Minify
It will remove all white spaces before and after HTML tags.
Before Minify
function hello(name) {
alert('Hello, ' + name);
}
hello('New user');
After Minify
function hello(a){alert("Hello, "+a)}hello("New user");
Original Size : 100 bytes gzipped (90 bytes uncompressed)
Compiled Size : 68 bytes gzipped (55 bytes uncompressed)
Advantages over Speedy
- No Drupal version restriction
- You can use Minify even if you modify any core JavaScript
- Minify does not hold pre minified JavaScript files set
Advantages over uglifyjs
- Minify relies on well know webservice i.e. GOOGLE Closure Compiler
Installation instructions
- Enable the module
- Goto Configuration > Performance in Bandwidth optimization section, select Minify HTML and Use Minified JavaScript files
- Hit Save configuration
- Selecting the Use Minified JavaScript files does not enough to improve performance, select Minify JavaScript files tab at top of the page to generate minified JavaScript files
- If Boost module is already enabled, clear Boost caches to regenerate page with Minify
If you are upgrading to 7.x-1.4, execute module update.
Project information
- Module categories: Performance and Scalability, Third-party Integration
8,105 sites report using this module
- Created by atul.bhosale on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 7.x-1.x-dev updated 5 Jan 2020 at 07:58 UTC
- Testing result: PHP 5.3 & MySQL 5.5, D7 Build Successful all results










