Minify HTML content in and MVC

If you have website in MVC, here is good news for you. Now you can minify HTML content from just simple command line tool. Special thanks to Deanhume

Generally we use Google PageSpeed Insights to check website performance, as it provides tips to improve overall performance and page load time below are the image of that website.

Check website performance in this website
Check website performance in this website

We also use GTmetrix to check website performance it will provide almost every information which we have required to enhance our web application performance.

Check website performance in this website
Check website performance in this website

If you are developer, So there are some options are available to minify your HTML content is the HTML Minifier.

The HTML Minifier is a simple command line tool that remove white spaces in your HTML. The great thing about this tool it is useful for web-forms, MVC Razor view and MVC web-forms and plain HTML files. You just provide the path of your website it simply minify all your content.

Just download HTML Minifier command line tool from here

After download this project along with source code extract that project and go to tool folder in that folder you can get HtmlMinifier.exe we can use this .exe in our visual studio so at the time of publish it will provide the minify version of HTML.

So lets start the implementation of HtmlMinifier.exe:

Step 1: Place this .exe file in our project solution, So you can excess this .exe file and every time when you publish you website so it will minify your content.

Step 2: Open solution explorer in visual studio and go to properties under this Publish Profiles is present open that file, below is an screen shot for your reference.

Solution Explorer in Visual Studio
Solution Explorer in Visual Studio

Open that file with extension of .pubxml and placed this code after property group.

Don’t forget to replace your htmlminifier.exe file path with your original file path.

pubxml file
pubxml file

That’s it you are ready to publish your profile, Save your pubxml file and publish your project so it will run htmlminifier.exe and only minify the HTML files that get deployed. If you see your output window, so it will look like this.

Minify Output window
Minify Output window

The secret to getting this to work is “CopyAllFilesToSingleFolderForPackage” step in the built.

If you have any query or suggestion, So i’ll be happy to help you.


Ankur Omar

.htaccees for Magento Performance Optimization

Magento is one of the most widely used eCommerce platforms today that people to choose to grown their online business. Optimizing the speed of your Magento allows customers to have the best user experience while shopping in your e-commerce store. In this post, you will get some tips to increase Magento speed and Magento performance optimization techniques.

Every e-commerce shop owner and users love the faster website. If website speed is slow user may leave a website and buy products from your competitors.
So you want to speed up your Magento store, here are some htaccess file tips:

Browser Caching & htaccess Configuration

Enable Output Compression
The apache mod_deflate module, which compresses text, CSS, and javascript before it is sent to the browser. This result lower file size.

Gzip Compression
This will compress stylesheet and web page before sending them to browser

Enable Expires Headers
To determine how long web page components cached in a browser cache. Web page static components like images, stylesheets.

Disable ETags
Entity tags (ETags) are a mechanism that web servers and browsers use to determine whether the component in the browser’s cache matches the one on the origin server. ETags were added to provide a mechanism for validating entities that are more flexible than the last-modified date.

Mime Type Caching


Magento load JavaScript(JS) and CSS files in footer:


  • Rahul Dadhich