visual-studio-code - Visual Studio Code SASS 编译器

标签 visual-studio-code sass node-sass

我从 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"
      ]
    }
  ]
}

我测试过它工作正常。 但我有两个问题:

  1. 首先,它关注“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/

    相关文章:

    css - Bootstrap v4 网格大小/Sass 列表

    reactjs - 构建Reacjs项目后不透明度值改为1%

    google-chrome-extension - 在 Visual Studio Code 中调试 Chrome 扩展

    c++ - 错误 : "The preLaunchTask ' C/C++: g++. exe 构建事件文件'以退出代码 1 终止”

    css - 如何从用逗号(,)分隔的css中取出公因数

    css - Sass 可以默认编译器 autoprefixer 吗?

    visual-studio-code - 在 VS-Code 中编写多行代码片段的最佳方法是什么?

    visual-studio-code - VS Code SSH 不断断开连接,但我可以正常使用 SSH

    node.js - 更新 NodeJS 后使用 node-sass 的问题

    node.js - NodeJS OSX 构建 node-sass 时出错