Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to use SASS inside a Blazor Web Assembly project?

What is the best way to use SASS with Client side blazor. I looked into the this

https://github.com/madskristensen/WebCompiler

But it looks like works only with Visual Studio. I am using Visual Studio Code.

like image 407
Amitabh Avatar asked Jul 01 '20 05:07

Amitabh


People also ask

Can I use Sass in Blazor?

We can't use Sass files directly, they must be compiled it into valid Css first. There are a few different way of doing this but traditionally the common approach is to install Npm, a task runner like Gulp along with various other packages to handle the compilation and eventual minification.

How do you structure a Blazor project?

The Blazor Server app's entry point is defined in the Program. cs file, as you would see in a Console app. When the app executes, it creates and runs a web host instance using defaults specific to web apps. The web host manages the Blazor Server app's lifecycle and sets up host-level services.

How does Blazor WebAssembly work?

Blazor WebAssembly is a single-page app (SPA) framework for building interactive client-side web apps with . NET. Blazor WebAssembly uses open web standards without plugins or recompiling code into other languages. Blazor WebAssembly works in all modern web browsers, including mobile browsers.


1 Answers

As mentioned in the MS docs, you can use the Delegate.SassBuilder package to help you compile sass/scss files to css.

It works pretty well, and very easy to install with no configuration required.

NOTE

For newer Sass build requirements - I've created this LibSassBuilder

like image 119
JvR Avatar answered Sep 18 '22 17:09

JvR