简体   繁体   English

VS Code,保存文件时如何强制保存另一个文件?

[英]VS Code, How to force a save on another file when I save files?

I'm using the VS code extension: Live Sass Compiler with Live Server and when I save other scss files than my style.scss it doesn't compile my style.scss file.我正在使用 VS 代码扩展: Live Sass Compiler with Live Server ,当我保存 style.scss 以外的其他 scss 文件时,它不会编译我的 style.scss 文件。 Is there a setting I missed to do this?有没有我错过的设置?

Since I did not find any setting for this, I thought I want to use a filewatcher so if any scss file is saved, I want to force a save on my style.scss to trigger the live sass compile.由于我没有找到任何设置,我想我想使用文件观察器,所以如果保存了任何 scss 文件,我想强制保存我的 style.scss 以触发实时 sass 编译。

So I added the extension File Watcher and now I wonder what cmd to use to force a save on my style.scss file.所以我添加了扩展文件观察器,现在我想知道用什么cmd来强制保存我的 style.scss 文件。 In File Watcher extension I get the echo everytime I save a.scss file using this:在 File Watcher 扩展中,每次我使用以下方法保存 a.scss 文件时都会得到回显:

{
  "filewatcher.commands": [
    {
      "match": "\\.scss*",
      "isAsync": true,
      "cmd": "echo '${file} file content Changed'",
      "event": "onFileChange"
    }
  ]
}

I think I need a shell command or something to force a save on my style.scss file, but I have no idea how to do it.我想我需要一个 shell 命令或其他东西来强制保存我的 style.scss 文件,但我不知道该怎么做。 I was thinking something like ls style.scss but that is as far as I got.我在想像 ls style.scss 之类的东西,但就我所知。 Or can I trigger the sass live compile directly on the style.scss file?或者我可以直接在 style.scss 文件上触发 sass 实时编译吗?

I just needed to put underscore _ on my partial scss files.我只需要在我的部分 scss 文件上加上下划线 _。 Then it will recompile my style.scss file.然后它会重新编译我的 style.scss 文件。

暂无
暂无

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

相关问题 如何在其他位置保存VS代码设置和代码段文件 - How to save VS Code settings and snippets files in another location 为什么当我将 VS 代码中的代码文件保存为 .js 文件时,它不会在浏览器中运行或打开? - why is that when I save a code file in VS code as a .js file it wont run or open in a browser? 在 VS 代码中,每当我将文件保存在 Html 中时,当我实际上希望它保存为 Chrome Html 文档时,它就会保存为 Brave Html 文档。 怎么做? - In VS code, whenever I save a file in Html its being saved as Brave Html document when I actually want it to save as Chrome Html doc. How to do it? VS Code:保存时代码被推到右侧 - VS Code: Code gets pushed to the right when I save 如何设置 VS Code 以使用 shift ZZ 保存文件? - How can I set up VS Code to save files using shift ZZ? ReactApp-当我在VS代码编辑器中将js文件中的更改保存时,浏览器不会刷新页面。 - ReactApp - The browser does not refresh the page when i save changes in my js file in VS code editor . 当 VS 代码无法将文件保存到 SSH 远程服务器时,我该怎么办? - What can I do when VS code can NOT save file to SSH remote server? 如何在 VS Code 中轻松保存远程 ipynb 文件 - How to save remote ipynb files easily in VS Code 当我们在vs代码工作区中保存文件时如何获取新修改行的行号? - How to get line number of the newly modified lines when we save a file in vs code workspace? 在 VS Code 中保存时格式化 *.tsx 文件 - Format *.tsx files on save in VS Code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM