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.
Related Posts
- BadImageFormatException for a 64-bit ASP MVC web application
- Crushing PNGs in .NET
- Blogger Classic Templates Bugs and XHTML
You Might Also Like
- How to get technical support without spending hours on the phone
- Email Alerts for new Referers in Google Analytics using Apps Script
- 15 minutes of terror, or how the UK has changed in four years
Comments
Thanks for the post!
Add Comment
All comments are moderated. Your email address is used to display a Gravatar and optionally for notification of new comments and to sign up for the newsletter.