Skip to content

Instantly share code, notes, and snippets.

@kentaromiura
Created June 18, 2009 18:21
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 kentaromiura/132082 to your computer and use it in GitHub Desktop.
Save kentaromiura/132082 to your computer and use it in GitHub Desktop.
LessController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
namespace MvcApplication1.Controllers {
public class LessController : Controller {
public ActionResult Get(string name)
{
string less = "";
using (var sr = File.OpenText(Server.MapPath("~/Content/" + name + ".less")))
{
less = sr.ReadToEnd();
sr.Close();
}
ViewData["name"] = name;
ViewData["less"] = less;
ViewData["css"] = lessCompiler.lessConverter.Convert(less);
return View();
}
public ActionResult Show(string name) {
string less = "";
using (var sr = File.OpenText(Server.MapPath("~/Content/"+name+".less"))) {
less = sr.ReadToEnd();
sr.Close();
}
ViewData["css"] = lessCompiler.lessConverter.Convert(less);
return View();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment