Skip to content

Instantly share code, notes, and snippets.

@slynch13
Created September 10, 2012 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slynch13/3689144 to your computer and use it in GitHub Desktop.
Save slynch13/3689144 to your computer and use it in GitHub Desktop.
dotless css bundle transform
public class LessTransform : IBundleTransform
{
public void Process(BundleContext context, BundleResponse response)
{
var parser = new Parser();
var importPath = context.HttpContext.Server.MapPath(context.BundleVirtualPath);
parser.Importer = new BundleImporter(importPath);
var env = new Env { Compress = true, Debug = true, KeepFirstSpecialComment = true, DisableVariableRedefines = false };
response.Content = parser.Parse(response.Content, null).ToCSS(env);
response.ContentType = "text/css";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment