You will need two things:

  • tasks.json file
  • Blade Runner extension for VS CODE

Start by creating .vscode folder in your project.

Then in it create tasks.json file with the following content:

{
    "version": "0.1.0",
    "command": "sass",
    "isShellCommand": true,
    "args": ["--watch", "."],
    "showOutput": "always"
}

Now, after opening the project you can run the task by clicking Ctrl+Shift+B.

To automate the process use Blade Runner extension - https://marketplace.visualstudio.com/items?itemName=yukidoi.blade-runner

Blade Runner will run the task automatically after opening the project :)

Answer from gabrieln on Stack Overflow
🌐
Medium
medium.com › @codingcarter › how-to-compile-scss-code-in-visual-studio-code-c8406fe54a18
How to Compile SCSS Code in Visual Studio Code | by Coding Carter | Medium
January 24, 2020 - ... Look at the bottom right of the Visual Studio Code interface, and you should see a button that says “Watch Sass”. Click the button, and the extension will generate a {filename}.css and {filename}.map.css file in the directory of all ...
🌐
Visual Studio Code
code.visualstudio.com › docs › languages › css
CSS, SCSS and Less
November 3, 2021 - As this is the only command in the file, you can execute it by pressing ⇧⌘B (Windows, Linux Ctrl+Shift+B) (Run Build Task). The sample Sass/Less file should not have any compile problems, so by running the task all that happens is a ...
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
scss-to-css - Visual Studio Marketplace
Extension for Visual Studio Code - 🔥 The easiest way to compile scss file to css. And autoprefixer at the same time.
🌐
Bangtech
data.bangtech.com › web › how-to-compile-your-sass-to-css-in-visual-studio-code.htm
How To Compile Your SASS/SCSS To CSS In Visual Studio Code
Sass is a CSS preprocessor with enhancements to the CSS syntax. Sass imports and mixings allows us to re-use codes and maintain a larger codebase. ... Close Visual Studio and wait for the installer to appear. Follow the steps to install the extension. Create a file named style.scss in the wwwroot ...
Top answer
1 of 5
9

You will need two things:

  • tasks.json file
  • Blade Runner extension for VS CODE

Start by creating .vscode folder in your project.

Then in it create tasks.json file with the following content:

{
    "version": "0.1.0",
    "command": "sass",
    "isShellCommand": true,
    "args": ["--watch", "."],
    "showOutput": "always"
}

Now, after opening the project you can run the task by clicking Ctrl+Shift+B.

To automate the process use Blade Runner extension - https://marketplace.visualstudio.com/items?itemName=yukidoi.blade-runner

Blade Runner will run the task automatically after opening the project :)

2 of 5
4

A solution without additional extensions

With sass

Assuming you have sass installed globally with for instance:

npm install -g sass

Open the folder and create a task.json file under .vscode containing

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
    {
        "label": "Watch Sass",
        "type": "shell",
        "command": "sass --watch src/style.sass styles/style.css --style=compressed",
        "problemMatcher": [],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "runOptions": {
            "runOn": "folderOpen"
        }
    }]
}

With node-sass

Replace sass with node-sass in the above.

In both cases make sure the source/destination filename, location and extension are correct (in my case src/style.scss and style/style.css)

With a Workspace file

Or copy the section in your .vscode-workspace file to avoid clutter of .json files.

Make sure to change the sass source and destination files to your personal needs.

Setup VSCode

[EDIT] whith the current version this is asked the first time you open the workspace file and the following steps are no longer needed. To a llow automatic run tasks

  1. Ctrl+Shift+P
  2. select Manage automatic Tasks and
  3. select Allow Automatic Tasks in Folder and
  4. close and reopen your folder (or Workspace)

The sass compiler will be called and starts watching all your edits with a reassuring:

Compiled css\src\style.sass to css\style.css.
Sass is watching for changes. Press Ctrl-C to stop.

or with error messages when compilation failed.:

Error: semicolons aren't allowed in the indented syntax.
  ╷
7 │     padding: 0;
  │               ^
  ╵
  css\src\_base.sass 7:12  @import
  css\src\style.sass 1:9   root stylesheet

EDIT command and args can be separated

{
    "label": "Compile sass",
    "type": "shell",
    "command": "sass",
    "args": [
        "--watch",
        "--style=compressed",
        "./style/src/main.sass",
        "./style/main.css"
    ],
    "runOptions": {
        "runOn": "folderOpen"
    }
},
🌐
YouTube
youtube.com › watch
Autocompile SCSS, LESS & More in Visual Studio | Web Compiler Guide - YouTube
Want to autocompile .less, .scss, .styl, .jsx, .es6 or .coffee in Visual Studio automatically on save, build and more? Well, Web Compiler is the plugin you'r...
Published   October 2, 2021
🌐
Reddit
reddit.com › r/visualstudio › visual studio 2022 sass compiler?
r/VisualStudio on Reddit: Visual studio 2022 SASS compiler?
May 15, 2024 -

I am currently working on a project that requires compiling sass and I cannot figure out how to do that in Visual Studio 2022. It seems like there isn’t a build in way to do that.

I have played with web compiler 2022 + and gulp scripts but they seem very janky.

What is your workflow/tools you use to compile SASS in visual studio 2022?

Thanks in advance!

Find elsewhere
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Web Compiler 2022+ - Visual Studio Marketplace
Extension for Visual Studio - The easiest and most powerful way to compile LESS, Scss, Stylus, JSX, CoffeeScript and Handlebars files directly within Visual Studio or through MSBuild.
🌐
Mikesdotnetting
mikesdotnetting.com › article › 367 › working-with-sass-in-an-asp-net-core-application
Working with Sass in an ASP.NET Core application
You can obtain it by going to the Extensions menu item within VS, and clicking Manage Extensions. Then, ensure that the Online option is selected on the left hand side of the dialog that appears, and search for "Web Compiler 2022". Once installed, it is easy to use. Right click on any .scss file ...
🌐
BlueWindLab
bluewindlab.net › setup-live-sass-compiler-for-visual-studio-code
Setup Live SASS Compiler For Visual Studio Code Editor
June 30, 2025 - Then, create a new "styles.scss" file inside that "scss" directory, and the extension will automatically compile all the scss code into a css file.
🌐
Book Worm Head
bookwormhead.com › blog › cms › how to install scss in visual studio – beginner’s tutorial to sass
How To Install Scss In Visual Studio - Beginner's Tutorial To SASS
November 6, 2019 - Start adding you scss code, you ... and among others. Click the Watch Sass located at the bottom of your Visual Studio to compile your SCSS to CSS or press ctrl+s (Windows) and cmd+s(Mac)...
🌐
Coding Campus
codingcampus.net › home › how to compile sass/scss to css in visual studio code
How to Compile SASS/SCSS to CSS in Visual Studio Code - Coding Campus
December 2, 2022 - For example, I am entering the following code: .card { position: relative; background-color: red; .card__name { background-color: blueviolet; } Click on the Watch Sass button from the Status bar at the bottom of VS Code.
Top answer
1 of 2
2

I realise this question is 10 months old, and I don't know if you worked out a way but I have been using Web Compiler for a while to compile my .scss files into stylesheets.

It's quite simple really and involves having a single stylesheet that imports from multiple files.

You state that this doesn't work, however I have used this process for a number of years and this is how I normally do it.

e.g. If you had a stylesheet called Default.scss, it's contents would look like this.

@import 'Reset.scss';
@import 'Defaults.scss';
@import 'Main.scss';

And your compilerconfig.json would look like this.

[
  {
    "outputFile": "wwwroot/css/styles.css",
    "inputFile": "Styles/Default.scss"
  }
]

I tend to have different stylesheets for different page styles drawn from a number of components, so if I have a page containing a product card, I would include the scss component that contains the style for that card.

If this doesn't help the OP because it was asked a while ago I hope that it's helpful to anyone else that finds it.

2 of 2
1

Per the configuration capabilities of Web Compiler 2022, it will minify but doesn't have bundling features. There is a .NET Nuget package named BuildBundlerMinifier that does allow minification and bundling. However it has not been updated since 2020 and will not work with any ES6+ JavaScript code. That's because it uses an older version of Nuglify (1.13.8) that performs JS code minification so there is no way of minifying ES6 and later code by using the tool currently (it will error on build). The pure .NET approach to this especially for razor pages / Blazor isn't super robust.

Therefore if a powerful JavaScript bundling tool is needed for a .NET web app, you'll need to explore Gulp, Grunt, or WebPack which are all mature JavaScript options for bundling and minification (and can be integrated into a .NET app). If minification is all you need, just stick with Web Compiler 2022, and reference each individual minified file.

🌐
MDBootstrap
mdbootstrap.com › standard › material design for bootstrap 5 & vanilla javascript
Compiling SCSS to CSS in Visual Studio Code - Material Design for Bootstrap
@import '~@angular/cdk/overlay-prebuilt.css'; --------^ Compilation Error Error: Undefined variable: "$radio-label-pl". on line 15 of sass/c:\EduClarity\AspNetZero\AngularApp\Analytics\angular\node_modules\ng-uikit-pro-standard\assets\scss\core\msc_radio-pro.scss from line 1 of sass/c:\EduClarity\AspNetZero\AngularApp\Analytics\angular\node_modules\ng-uikit-pro-standard\assets\scss\msc-pro.scss
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Sass Compiler - Visual Studio Marketplace
Extension for Visual Studio - Transpiles Sass/Scss files to CSS and minifies it instantly - every time you save the file
🌐
Stack Overflow
stackoverflow.com › questions › 71393133 › how-to-compile-all-scss-to-style-css-with-live-sass-compiler
visual studio code - How to compile all scss to style.css with Live Sass Compiler? - Stack Overflow
{ "format": "expanded", "extensionName": ".css", "savePath": null }, // You can add more { "format": "compressed", "extensionName": ".min.css", "savePath": "/dist/css" }, // More Complex { "format": "compressed", "extensionName": ".min.css", "savePath": "~/../css/" } ]
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Live Sass Compiler - Visual Studio Marketplace
Extension for Visual Studio Code - Compile Sass or Scss to CSS at realtime with live browser reload.
🌐
Stack Overflow
stackoverflow.com › questions › 72553672 › expanding-css-in-scss-sass-in-visual-studio-community-2022
Expanding CSS in SCSS (Sass) in Visual Studio Community 2022 - Stack Overflow
I can access all the SCSS files but cannot figure out how to expand the CSS (no hyperlink available). Here's an image of one of the SCSS files: css · visual-studio · twitter-bootstrap · sass · bootstrap-5 · Share · Improve this question · Follow · asked Jun 9, 2022 at 1:04 ·