A while ago I blogged about the state of Sass support in ASP.NET. Since then, a lot has changed: Sass hit version 3.3, libsass has become extremely popular, and Visual Studio 2013 now has support for Sass built in.
Unfortunately in the case of NSass, it hasn’t been updated in over a year. For that reason, I’ve been porting most of the functionality over to libsass-net, and the nuget packages and ASP.NET integration has been a glaring whole in that project for a while.
Since libsass is a C++ project, you’ll need to make sure you have the Visual C++ Redistributable installed. I’m not a C++ expert, so I’m not sure if the latest version works or if you need the 2012 version.
Integrating with System.Web.Optimization
Integrating with the System.Web.Optimization project is very simple with libsass. Below is an example configuration:
var sass = new SassBundle("~/content/css", basePath: "~/sass") .Include("~/sass/app.scss") .Include("~/sass/fonts.scss"); bundle.Add(sass);