You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bundling requires NSass.Handler in debug mode (BundleTable.EnableOptimizations == false or <compilation debug="true" />), but works without it in production mode.
If you want to play with libsass through your own C# code, core library will be enough:
By default, NSass core adds current directory as import path while compilining a file. NSass handler additionaly adds web project root.
So you may use both relative and absolute paths in includes. For example, if you have Site.scss in your Content folder, and this file includes Common.scss from the same folder, everything below will work in the same way:
@import “Common.scss”;
@import “Content/Common.scss”;
@import “/Content/Common.scss”;
@import “../Common.scss”;
What is important to know – only first found file will be included. Searching process goes through current directory first, then through web site root.
This may cause issues if you have another Content folder with Common.scss file inside, which is under root Content folder. Illustration:
//ContentSite.scss
Common.scss // <-- this file will be not included/Content
Common.scss // <-- only this
What about unit testing / dependency injection?
NSass is covered by a small pack of tests. They do not check correctness of SASS processing (what tests for SassC do), only parameters passing correctness.
You could mock NSass classes in your tests or use your favorite IoC container for initialization.
There are two extension points – ISassInterface in C++/CLI code, and ISassCompiler in C# code, implemented as SassInterface and SassCompiler accordingly by default.
In most cases you should deal with ISassCompiler only.
Roadmap
SASS compilation tool for Windows for usage outside of .NET world.
All the other potential features (i. e. Compass support) will be merged from libsass when they will appear there.
Known issues
libsass does not support other output styles than nested and compressed now, but declares them on interface level. You will get an exception when trying to use expanded, echo, or compact output style.