VS Code 不会让我使用 sass 编译 sass --watch



我正在尝试使用终端编译sass。我已经安装了node.js,在使用Live Sass时没有任何问题,然而,每次我试图编译我的Sass时,我都会得到这样的结果:

sass : The term 'sass' is not recognized as the name of a cmdlet, function, script file, or operable program.     
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ sass -watch scss:css
+ ~~~~
+ CategoryInfo          : ObjectNotFound: (sass:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

我正在尝试使用@use,我知道Live Sass编译器不会让我这么做。我做错了什么吗?或者我需要安装的其他东西?哦,我已经用npm install sass安装了sass。

平视:有几种方法可以将SASS与VS代码一起使用。但请确保使用与Dart SASS一起运行的最实际的版本。要通过NPM安装,这里有一些信息:

是使用Live Sass编译器(VS代码扩展(更好,还是通过npm安装和运行Sass更好?(+提示如何从节点sass更改为省道sass(

这里有一些关于通过安装VS代码扩展来使用SASS的信息,这可能会让它使用起来更舒适:

Live Sass编译器-@use导致编译错误

您有两个选项:

  1. 尝试在全局范围内安装

    npm安装-g节点sass

  2. 将此添加到package.json文件

    "devDependencies": {
    "node-sass": "4.5.0"
    },
    "scripts" : {
    "node-sass": "node-sass --output-style compressed -o dist/css src/scss"
    }
    

    之后,运行:

    npm i;npm run node-sass;
    

最新更新