RazorMinifier is a free extension for Visual Studio 2019. You can download RazorMinfier either from the Extension Manager in VisualStudio or from the official Extension Market Place.
With RazorMinifier you can minify
html files while still editing them with all intends and so on.
So what are the key-benefits about this extension? That is not as easy as you might think.
In general minifying is already a pretty good approach for reducing file sizes by around 40%. Anyway compressing files with either
Brotli (br) or
gzip is an even better improvement, but this is not always possible.
If you have any website with which is secured by TLS you are potentially opening security risks under specific circumstances. With that I am referring to BREACH and CRIME. For more details click on either of the attacks name or see breachattack.com. Although there are a few requirements that are needed in order to be exposed by the named attacks, see any of the links mentioned above.
With that said there is a pretty good chance that you don't want to compress your files anymore. Therefor minifying your html is a pretty good idea, anyhow editing inline html is a real pain in the ass and that is where RazorMinifier comes in to help you out.
The configuration file must be located on the root Directory of the Startup-Project and must be named
Rminify.json. Although when you hit
Add/Remove Razor Minify and the config file does not exist, it will automatically get generated for you.
.htmlfile if you haven't already then hit right-click on this file. Which should you a few options as shown in the image. Now click on
Add/Remove Razor Minify.
.edit.cshtmlfile in your project and as soon as you hit save, it will update the corresponding
If you want to remove a file from the minifying process either hit
Add/Remove Razor Minifyagain or edit the
Rminfy.jsonfile, also you can add files the same way by editing the config file.
- Minifying of
htmlfile on save
- Toggling addition/removal with a simple click
- Manual editing of the
- Maintains functionality of
cshtmlfiles after minifying
- Does only minimize deployment size
- Support for
Razorfiles regarding to Blazor.
If you feel like something is not working as intended or you are experiencing issues, feel free to create an issue. Also for feature requests just create an issue. For further information feel free to send me a mail to
firstname.lastname@example.org or message me on Discord