Compiling Sass code in VS code using node-sass

Hi,

I am trying to use the below link to try and compile some SASS code into CSS.

I have copied the code as stated but I am getting the error that they talk about in the documentation. I don’t really understand it though and don’t know how to solve the issue . Can someone please help?

Note: If your build fails or you see an error message such as “An output directory must be specified when compiling a directory”, be sure the filenames in your tasks.json match the filenames on disk. You can always test your build by running node-sass styles.scss styles.css from the command line.

// Sass configuration
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Sass Compile",
            "type": "shell",
            "command": "node-sass styles.scss styles.css",
            "group": "build"
        }
    ]
}

This is the problem and the code I’ve used. Further details can be found in the link above.

Anyone know what to do with this? I am getting absolutely nowhere and don’t really know where to turn to.

The error message is asking you to check that you have a file called styles.scss.

You may also have to check that you are running it with the right file path. If you are in your project’s root directory and the scss file is in another folder, you probably have to be more specific with the file path in the task runner.

Cheers. I decided to just use Gulp to get it done. Was a lot simpler than I thought, too much hassle going through VS code building tasks etc.

1 Like