简体   繁体   中英

C# Sass Compiler

So I have a C# (asp.net) based dashboard for a proprietary content management system. One of the things that the dashboard allows is for the user to go in and add custom css/sass to their site. When they do this, my controller calls a program that compiles the sass using NSass.Core.

Up until now, I have been using Foundation 5 as my responsive framework. Yesterday when attempting to update my controller to allow for Foundation 6 compilation, it started throwing errors. The errors were occurring every time the compiler attempted to parse a sass map (associative array).

I started doing some research into the problem and found out that sass maps are a relatively new mechanic in sass and the last time Nsass was updated was three years ago, so I am assuming this is the problem.

Has anyone had similar experience? If so, what was your solution. If not, does anyone use anything else that would work for me? I have tried installing a couple other packages, but started receiving various other errors such as libsassnet not being able to find the 32 bit dll. Hopefully someone here can give me an answer that saves me some time.

The errors I have received when using Nsass were all along the lines of "error reading values after primary" where primary is the first value in the first map the compiler comes across. When I take that map out, it just moves to the next one and gives the same error.

As far as narrowing my question down... I just want to know what other people are using out there to compile Sass in C#

There is a nuget package: Bundle Transformer: Sass and SCSS is a provider for Bundle Transformer . In turn, this is an extension of System.Web.Optimisation that could allow you to add code to your CMS to compile user generated SCSS into Css files.

An example of this can be found in the Optimus package for the Umbraco CMS. Looking through this code could give you a good basis for creating your own system. If you speak with the Author of the package (a really nice guy) he might be able to help you create your own targeted package that isn't dependent on Umbraco.

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM