I wrote a post about using Variables in CSS a while back (here).
Someone asked a question about something similar so I thought I'd rewrite it for MVC3. It seems that adding the [OutputCache] to the method changes the ContentType from "text/css" to "text/html" causing the CSS to not be applied.How would I go about keeping the ContentType and Caching the output?Code Csharp:[OutputCache(VaryByParam = "none", Duration = 3600)] public ActionResult Index() { var cssDefs = new Css(); cssDefs.Background = "808"; cssDefs.Width = "500px"; cssDefs.WrapperMargin = "0 auto"; cssDefs.Foreground = "ff0"; Response.Filter = new CSSCompressor(Response.Filter); Response.ContentType = "text/css"; return View(cssDefs); }



Reply With Quote
Bookmarks