I'm using ASP.NET MVC 5 and would like to create a page that lists a .less file's variables and their values as textboxes. My goal is to make a small page that lets you edit their values.
public JsonResult GetLessVariables()
{
var file = System.IO.File.ReadAllText("~/some.less");
/*
Create key value pair of variable and value from file
i.e
@body-color, #000000
@text-color, #ffffff
*/
return Json(data, JsonRequestBehavior.AllowGet);
}
Is there some easy way to get them into a key value pair dictionary or similar?
EDIT: Example of .less file:
//
// Test
// --------------------------------------------------
@body-color: #000000;
@text-color: #ffffff;
// Test
.test {
background: @body-color;
color: @text-color;
}
.... and so on
答案 0 :(得分:1)