Skip to content

Instantly share code, notes, and snippets.

@abfo
Created September 30, 2018 17:46
Show Gist options
  • Save abfo/b1cef45795c7aeebd145bfc8596db70b to your computer and use it in GitHub Desktop.
Save abfo/b1cef45795c7aeebd145bfc8596db70b to your computer and use it in GitHub Desktop.
public ActionResult InlineCss()
{
BundleContext context = new BundleContext(
new HttpContextWrapper(System.Web.HttpContext.Current),
BundleTable.Bundles,
"~/Content/css");
Bundle cssBundle = BundleTable.Bundles.GetBundleFor("~/Content/css");
BundleResponse response = cssBundle.GenerateBundleResponse(context);
CssMinify cssMinify = new CssMinify();
cssMinify.Process(context, response);
return Content(response.Content);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment