Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using SASS with ASP.NET [closed]

Tags:

css

sass

asp.net

I'm looking into ways to use SASS (Syntactically Awesome StyleSheets) from the Ruby HAML package in an ASP.NET environment. Ideally, I would like compilation of SASS files into CSS to be a seamless part of the build process.

What are the best ways to this integration? Alternatively, are there other CSS-generation tools that are better suited for a .NET environment?

like image 670
Guðmundur H Avatar asked Apr 28 '09 08:04

Guðmundur H


People also ask

Is Sass and SCSS same?

SASS (Syntactically Awesome Style Sheets) is a pre-processor scripting language that will be compiled or interpreted into CSS. SassScript is itself a scripting language whereas SCSS is the main syntax for the SASS which builds on top of the existing CSS syntax.

Is ASP Net deprecated?

Note that the entire ASP.NET MVC library is now obsolete.

Can I use Sass in SCSS?

It is Sass that will generate a CSS file for us with the same code. To start, create a folder with two folders inside, CSS and images. Then inside the CSS folder create a file with the Sass extension – in my case it's style. scss.


2 Answers

For a better working experience in Visual Studio, you could install the last version of Web Essential which is starting to support Sass (SCSS syntax).
Alternatively you could install Sassy Studio or Web Workbench.

Then to compile your .sass/.scss files in your ASP.NET project, there is some different tools: via Web Essential, Web Workbench, SassC, Sass.Net, Compass, SassAndCoffee...


Web Essential a fully featured plugin for Visual Studio, which really give a better experience for all Front-End stuffs. The latest version is starting to support Sass (SCSS syntax). Internally it use the Libsass to compile the SCSS to CSS.


Web Workbench is another plugin for Visual Studio that add syntax highlighting, intellisence and some other useful stuff for editing SCSS files. It can also compile your code into normal or minified CSS. Internally it used a wrapped version of the Ruby Sass compiler.


Sassy Studio: another plugin for Visual Studio. Less featured but much lighter.


The Libsass library is C++ port of the Sass CSS precompiler (still in development). The original version was written in Ruby, but this version is meant for efficiency and portability. This library strives to be light, simple, and easy to build and integrate with a variety of platforms and languages.

There are several wrappers around the Libsass library:

  • SassC: a command line compiler (on Windows you need to compile the source of SassC with MsysGit to get the sassc.exe).
  • NSass: a .Net wrapper.
  • Node-Sass: to use Libsass on Node.js.
  • etc.

Compass is a framework for Sass that add a lot of useful helpers (like image spriting) and can also compile your SCSS/Sass. But you need to install Ruby on each development environment where you need to compile your styles.


SassAndCoffee is a package that adds SCSS/Sass compilation and minification support, via some DLLs and configs. Its advantage over the Web Workbench compiler is it's self-contained into your Visual Studio solution: you don't need to install a plugin on every development environment. Remark: SassAndCoffee is not often updated, and because it use IronRuby to wrap the official Ruby compiler, you can get some performance issues. You can install the latest version via a Nuget package.

like image 133
Etienne Avatar answered Oct 12 '22 00:10

Etienne


The compass project has a compiler that will compile your sass to css. It's built to run on windows, but it is not well tested on that platform. If you find any platform related bugs, I'll gladly help you fix them.

Compass can be found here: http://github.com/chriseppsein/compass

like image 45
chriseppstein Avatar answered Oct 12 '22 00:10

chriseppstein