我从 Sublime 切换到 VS Code,因为它不再支持 PHP 和 SASS。我主要使用 CSS & SASS & JS & PHP。
我从VS Code documentation设置了一个SASS编译器。如下:
// 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 style.scss style.css",
"group": "build",
"problemMatcher": [
"$eslint-compact"
]
}
]
}
我测试过它工作正常。 但我有两个问题:
- 首先,它关注“style.scss”文件。我的意思是,无论我们在“.json”中提到什么。
Actually what I want is: Focus on all ".scss" files without searching for a name.
- 当我在打开“a.scss”编辑器的情况下运行编译时,它仅编译“.json”文件中的名称。但其中不包含“a.scss”!
Actually what I want is: If I press the "CTRL + SHIFT + B" key and select the corresponding option, the currently active editor is the "a.scss" compilation.
有这方面的设置吗?
注意:"command": "node-sass .scss .css",
会报错。
最佳答案
实际情况是,SASS
实现为新版本Dart SASS
。其中有像 @use
这样的新规则......因此需要更新使用的编译器。
据我所知,到目前为止 Node Sass 还没有。
在 VS Code 中使用 SASS 的更好方法是使用扩展。
正如我们遇到过几次这样的情况:
如果您对此感兴趣,可以看这里https://stackoverflow.com/a/66207572/9268485
注意:如果您决定使用其中一个扩展程序,您的设置可能会更改。查看扩展说明。
关于visual-studio-code - Visual Studio Code SASS 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66764569/