ASP.NET sass/scss compilation at run-time and at compile-time?
Asked Answered
A

3

13

I am searching for a solution for compiling my .scss files at run-time and at compile-time.

The reason I need both is that our designers work on Macs and prefer the ease of having their .scss files compiled dynamically at run-time (especially during a development phase). On the other hand, I need compile-time support to validate that the SCSS compiles successfully during my build process. My goal is to fail a build if the SCSS doesn't compile.

I have found several libraries available on NuGet, however, minor flaws in each of them are holding me back.

Is there a solution available for both of these scenarios?

Here's where my research has led me:

Run-time Support

Compile-time support:

  • Cassette.MSBuild (Does not appear to bundle SCSS files, only CSS)
  • Mindscape Web Workbench (Pro version apparently includes a command-line tool, however, documentation is very limited on the feature)
  • Others?
Awash answered 16/5, 2013 at 21:56 Comment(2)
It's seems you're still early into your adoption of SASS. Have you thought of using Compass or are you to invested in Bourbon to consider changing? compass-style.orgMargheritamargi
Go for compass watch.Encephalon
A
4

The Pro edition of the Mindscape Web Workbench includes a command-line tool for compiling at runtime. Currently, only the nightly build is capable of compiling Bourbon and Neat (one of my requirements).

Here is my pre-build event which is working great at the moment:

"C:\Program Files (x86)\Mindscape\Web Workbench\Command Line\wwcmd.exe"
"$(ProjectDir)scss\style.scss" /o:../css /style:compressed

UPDATE:

We decided to simply call SASS from a pre-build event as opposed to using Web Workbench.

call sass -C "$(ProjectDir)assets\scss\main.scss" "$(ProjectDir)assets\css\compiled\main.css" --style compressed
Awash answered 11/10, 2013 at 19:0 Comment(0)
C
1

Check out SassAndCoffee. It's what Cassette is using and it embeds everything into a few assemblies.

Web Workbench on the other hand actually installs ruby and the sass gems to the file system in a very long folder path hidden beneath the current users directory, which is likely to be troublesome for a web application and with respect to security and permissions.

Clammy answered 18/6, 2013 at 7:40 Comment(0)
G
1

For ASP.NET Core you can use this package to compile scss at build time and it includes a watcher for debug-time and hot-reloading.

AspNetCore.SassCompiler

Sass Compiler Library for .NET Core 3.1/5.x./6.x without node.

https://github.com/koenvzeijl/AspNetCore.SassCompiler

# Package Manager
PM> Install-Package AspNetCore.SassCompiler

# .NET CLI
dotnet add package AspNetCore.SassCompiler
Gsuit answered 21/9, 2022 at 19:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.