Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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