简体   繁体   English

实时 sass 编译器未生成 css 文件

[英]live sass compiler not generating css files

I use live sass compiler extension in vsCode then generation css not worked for me until I save main.scss file.我在vsCode中使用实时 sass 编译器扩展,然后生成css在我保存main.scss文件之前对我不起作用。

for example have a project contains this directory例如有一个项目包含这个目录

+style
 - style.css
 - main.scss
 - dashboard (folder)
  --_sidebar.scss

+index.html

if change happened in _sidebar.scss nothing happened, but then I save main.scss file and generation happened.如果在_sidebar.scss中发生了变化,什么也没有发生,但是我保存了 main.scss文件并生成了。

its always same and every time I use live sass compiler boring me when change SCSS file then again save main.scss just to generate CSS file.它总是一样的,每次我使用实时 sass 编译器时,更改 SCSS 文件都会让我感到厌烦,然后再次保存main.scss只是为了生成 CSS 文件。

I changed live sass compiler setting in setting.json to this:我将setting.json中的实时 sass 编译器设置更改为:

"liveSassCompile.settings.formats": [
    {
      "format": "compressed",
      "extensionName": ".css",
      "savePath": "~/../style",
      "savePathSegmentKeys": null,
      "savePathReplaceSegmentsWith": null
    }
  ]

but it generate all SCSS files in any folder in my computer and I don't know how to fix it.但它会在我电脑的任何文件夹中生成所有 SCSS 文件,我不知道如何修复它。

I want to generate CSS file every time when change happen in any SCSS file每次在任何 SCSS 文件中发生更改时,我都想生成 CSS 文件

Just to let you know, my maintained fork supports multi-root workspaces.只是为了让您知道,我维护的 fork支持多根工作区。 if you install that, you can keep your settings/structure the same and it will just work如果你安装它,你可以保持你的设置/结构相同,它会正常工作

just change your code in settings.json to this one:只需将 settings.json 中的代码更改为以下代码:

{
"liveSassCompile.settings.formats": [
  {
    "format": "expanded",
    "extensionName": ".css",
    "savePath": "/css"
  },
  {
    "format": "compressed",
    "extensionName": ".min.css",
    "savePath": "/css"
  }
],
"liveSassCompile.settings.excludeList": ["**/node_modules/**", ".vscode/**"],
"liveSassCompile.settings.generateMap": true,
"liveSassCompile.settings.autoprefix": ["> 1%", "last 2 versions"]

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM