are any alternatives for compile .scss files in action in ASP.NET MVC controller?
I have /Content folder with two files: main.scss and external.scss. In my controller I'm using NSASS package:
public ActionResult GetCss(string scssPath)
{
string scss = @"@import """ + Server.MapPath(scssPath) + @""";";
var compiler = new SassCompiler();
string compiled = compiler.Compile(source: scss);
return Content(compiled.ToString(), "text/css");
}
my view:
<link href="@Url.Action("GetCss", "Theme", new { scssPath="~/Content/sass/main.scss" })" rel="stylesheet" type="text/css" />
main.scss file:
@import "external";
I have error
Error: File to import not found or unreadable: external
I tried to write @import "external.scss" but same problem.
Partial
, but then we'd be back to your chosen solution - so I'll defer to those who actually use it (and remove my answer). – Sedge