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.

Install the Web Compiler extension to Visual Studio

  • Click on Extensions > Manage Extensions > Online
  • Now search for "Web Compiler"
  • Click on the Download button
  • Close Visual Studio and wait for the installer to appear. Follow the steps to install the extension.

Create a SCSS file

  • Create a file named style.scss in the wwwroot > css folder
  • Now right click on the newly created style.scss file and click on Web Compiler > Compile file.
  • Then, you should have a style.min.css file and a style.css file underneith the style.scss file.

compiler.config may have multiple scss files

[
  {
    "outputFile": "wwwroot/css/style.css",
    "inputFile": "wwwroot/css/style.scss"
  },{
    "outputFile": "wwwroot/css/menu.css",
    "inputFile": "wwwroot/css/menu.scss"
  }
]

Compile Sass Files in Visual Studio 2019 Using Web Compiler