Thank you for clarifying the folder structure. I can see now why it wasn’t working. The style.css file and index.html file are in the same folder; there is no separate CSS folder. I’ve amended the HTML to reflect this and it works. Brilliant - thanks for your help! Answer from cprieststephens on forum.freecodecamp.org
🌐
Visual Studio Code
code.visualstudio.com β€Ί docs β€Ί languages β€Ί css
CSS, SCSS and Less
November 3, 2021 - Hovering over a selector or property will provide an HTML snippet that is matched by the CSS rule. This is supported for Sass and Less variables in the same file. CSS variables per the draft standards proposal are also supported.
🌐
YouTube
youtube.com β€Ί watch
How to add SCSS file to HTML (visual studio code) - YouTube
Footage about adding SCSS file to HTML using Visual Studio Code and Live Sass Compiler.
Published Β  February 14, 2021
Discussions

How do you link CSS and HTML files on VS Code?
Hi all, I’ve recently started using VS Code and have been unable to link the CSS and HTML files. I’ve uploaded a code snippet with the link tag I’m using. I’ve also tried copying and pasting the specific file pathway for the CSS file but this didn’t work either. More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
June 10, 2022
sass - VS Code SCSS auto compiling to CSS - Stack Overflow
I am total beginner in programming and just started to learn HTML/CSS. For coding I started to use VS Code. And I really like it. Only problem so far, what I got, is auto compiling of SCSS to CSS... More on stackoverflow.com
🌐 stackoverflow.com
sass - How to import SCSS files into HTML files - Stack Overflow
I create a simple website project with simple HTML and SCSS. the HTML file seems like this: More on stackoverflow.com
🌐 stackoverflow.com
Link HTML file with CSS file in Visual Studio - Stack Overflow
Im a beginner in Visual Studio and my html file/code work fine but my css file doesn't work. My problem is not detected in the workspace. I also try to do this, nothing happen : More on stackoverflow.com
🌐 stackoverflow.com
🌐
YouTube
youtube.com β€Ί watch
How to add SCSS link to your HTML project - YouTube
In this video, we will be using a newer syntax called SCSS.The IDE that we are going to be using is Visual Studio Code. SCSS Sassy CSS is a CSS preprocessor,...
Published Β  December 12, 2022
🌐
Adebola's blog
onedebos.wordpress.com β€Ί 2019 β€Ί 08 β€Ί 01 β€Ί how-to-setup-sass-in-vscode
How to setup SASS in VSCode – Adebola's blog
August 1, 2019 - VSCode has a boilerplate shortcut for this. simply type β€œ!” into the HTML file and then press the enter key. Create a styles.scss file. When you create a .scss file, you will see a pink β€˜s’ logo on the side of the file in your explorer ...
🌐
Visual Studio Code
code.visualstudio.com β€Ί docs β€Ί languages β€Ί html
HTML in Visual Studio Code
November 3, 2021 - You can read more about using custom data in the vscode-custom-data repository. Install an extension to add more functionality. Go to the Extensions view (β‡§βŒ˜X (Windows, Linux Ctrl+Shift+X)) and type 'html' to see a list of relevant extensions to help with creating and editing HTML. Tip: Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplace. ... CSS, SCSS, and Less - VS Code has first class support for CSS including Less and SCSS.
🌐
Quora
quora.com β€Ί How-do-I-connect-a-SASS-file-to-a-CSS-file-in-VScode
How to connect a SASS file to a CSS file in VScode - Quora
Answer (1 of 2): Do you mean how to convert a Sass file to a CSS file? The best option is to use a build tool like Gulp/Grunt. You can also use module bundlers like Webpack or Parcel but, I think, that would be overkill.
Find elsewhere
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"
    }
},
🌐
Coding Campus
codingcampus.net β€Ί home β€Ί how to run css code in visual studio code
How to Run CSS Code in Visual Studio Code - Coding Campus
December 2, 2022 - In our case, we are writing an HTML code to print out the words β€œWelcome To CSS”. Within the Head Tag, add this line of code. ... This code tells the browser to use style.css as our style sheet.
🌐
YouTube
youtube.com β€Ί the wheelchair guy
How to run SASS files on Visual Studio Code - YouTube
In this video, I will show you how to compile SASS files on Visual Studio Code. The first thing is you need to install an extension that will help you transp...
Published Β  September 15, 2021
Views Β  7K
🌐
Visual Studio Marketplace
marketplace.visualstudio.com β€Ί items
HTML to CSS / LESS / SCSS - Visual Studio Marketplace
Extension for Visual Studio Code - Copy HTML code and paste it as CSS / LESS / SCSS selectors code
🌐
Educative
educative.io β€Ί answers β€Ί how-to-use-sass-in-your-html-code
How to use SASS in your HTML code
Here is a link to the Live Sass Compiler extension. Create a HTML file and name it index.html. Include the <p> element that we want to style with SASS. Note: Please note that browsers do not recognize SASS, so a compiler needs to compile it to CSS.
🌐
Sololearn
sololearn.com β€Ί en β€Ί Discuss β€Ί 2965224 β€Ί help-i-need-to-link-my-css-and-html-documents-in-vs-code
Help I need to link my css and html documents in vs code | Sololearn: Learn to code for FREE!
January 20, 2022 - To link CSS to a HTML (example) : <head> ... <link rel ="stylesheet" href = "user1/desktop/folder1/folder2/filename.css"> ... </head> I don't know if it will help, but the only way I found to link sheets, images, websites etc using vsc, is by ...
🌐
Dieno Digital
dienodigital.com β€Ί home β€Ί css tips and tricks β€Ί how to link css to html in visual studio code
How to Link CSS to HTML in Visual Studio Code | Dieno Digital Marketing Services
June 1, 2021 - How to CSS file to HTML file in Visual Studio Code using this easy step by step tutorial. In this tutorial, we will test that everything is linked by changing the H1 to the color red using CSS. We use Visual Studio Code but you can do the same step in any other code editor
🌐
Medium
medium.com β€Ί @defrian.yarfi β€Ί html-and-scss-development-in-visual-studio-code-3650b09a5ce3
HTML and SCSS Development in Visual Studio Code | by Code Road | Medium
March 29, 2020 - Extension tools I’ve used in Visual Studio Code extensions was from Ritwick Dey : ... Static Assets : 1. index.html 2. Javascript / jQuery, Bootstrap 4 SCSS and Font Awesome 5 SCSS. Project directories, I used my real project (Decorplus.id) for this demos: β€” root/ β€” β€” β€” .vscode/ β€” β€” β€” β€” settings.json β€” β€” β€” src/ β€” β€” β€” β€” assets/ β€” β€” β€” β€” assets/css/ β€” β€” β€” β€” assets/js/ β€” β€” β€” β€” assets/img/ β€” β€” β€” β€” assets/vendors/ β€” β€” β€” β€” assets/webfonts/ β€” β€” β€” index.html β€” β€” β€” scss/ β€” β€” β€” β€” _base.scss β€” β€” β€” β€” _variables.scss β€” β€” β€” β€” main.scss β€” β€” β€” scss/vendors/ β€” β€” β€” scss/vendors/bootstrap/
🌐
Quora
quora.com β€Ί How-do-I-use-HTML-and-CSS-in-Visual-Studio-Code
How to use HTML and CSS in Visual Studio Code - Quora
Type: ! then Tab β†’ full HTML boilerplate. ... CSS abbreviation examples: m10 β†’ margin:10px; (adjust settings to change units). ... Install Live Sass Compiler or configure an npm build (sass package) to compile .scss β†’ .css. Typical workflow: create styles.scss, start compiler to produce styles.css, link the generated styles.css in HTML, edit .scss only.
🌐
Codeskill
codeskill.co.uk β€Ί 2024 β€Ί 01 β€Ί 28 β€Ί setting-up-scss-in-vscode-a-step-by-step-guide
Setting up SCSS in VSCode: A Step-by-Step Guide – codeskill
Here, we declare a variable for the primary color and use it to set the body text color. ... Open style.scss. Click on β€œWatch Sass” in the bottom right of the VSCode window. You’ll see a /css/style.css file generated, containing the compiled CSS. ... Create an HTML file in your project.