Page Not Found

Sorry, that page does not exist. Go Home, Search or give up and read the random post below:

 

 

Minify and inline CSS for ASP.NET MVC

Updated on Wednesday, April 28, 2021

Minify and inline CSS for ASP.NET MVC

ASP.NET has a CssMinify class (and a JavaScript variant as well) designed for use in the bundling pipeline. But what if you want to have your CSS minified and inline? Here is an action that is working for me (rendered into a style tag on my _Layout.cshtml using @Html.Action("InlineCss", "Home")).

Note that I'm using this to inline CSS for this blog. The pages are cached so I'm not worried about how well this action performs. My blog is also basically all landing pages so I'm also not worried about caching a non-inline version for later use, I just drop all the CSS on every page.

Add your comment...

Related Posts

You Might Also Like

(All Code Posts)

(Published to the Fediverse as: Minify and inline CSS for ASP.NET MVC #code #asp.net #mvc #css #inline #minify How to use ASP.NET MVC bundles to inline CSS and JavaScript for high performing landing pages. )