[英]VIsual Studio Code - Live Sass Compiler Not Generating .css File in Separate css Folder
I am trying to set the save location of my css file to its own css folder in the Live Sass Compile Config (Live Sass Compile > Settings:Formats)我正在尝试将我的 css 文件的保存位置设置为 Live Sass 编译配置中它自己的 css 文件夹(Live Sass 编译 > 设置:格式)
I have tried setting the savePath to "/css" - After this - I tried saving my main.scss file, which is supposed to generate a css folder with a main.css file in it.我尝试将 savePath 设置为“/css” - 在此之后 - 我尝试保存我的 main.scss 文件,该文件应该生成一个 css 文件夹,其中包含一个 main.css 文件。 However, it is just generating a main.css file in the same folder as my main.scss (which is in a scss folder).
但是,它只是在与我的 main.scss(位于 scss 文件夹中)相同的文件夹中生成一个 main.css 文件。
I have tried uninstalling and reinstalling VSC but my previous settings were saved.我已尝试卸载并重新安装 VSC,但我之前的设置已保存。
{ {
"format": "expanded", "extensionName": ".css", "savePath": "/css", "window.zoomLevel": 0, "editor.tabSize": 2, "editor.wordWrap": "off" } “格式”:“扩展”,“extensionName”:“.css”,“savePath”:“/css”,“window.zoomLevel”:0,“editor.tabSize”:2,“editor.wordWrap”:“关闭“}
The code above is all that shows in my.json file.上面的代码是 my.json 文件中显示的所有代码。 The top 3 lines are greyed/blacked out (format to save path).
前 3 行变灰/涂黑(保存路径的格式)。
This display in my.json file is way different than what I'm finding in tutorials on this. my.json 文件中的显示与我在教程中找到的有很大不同。
I strongly suggest you to avoid using that for sass.我强烈建议您避免将其用于 sass。 Use node-sass instead.
请改用 node-sass。 It's super easy to setup and run: Just install it from command line:
npm i node-sass -g
And run it in the background: node-sass [entry path-to-file] [output-path-to-file] -w
The -w
watches for changes in your.sass or.scss file and compiles straight away!它的设置和运行非常容易:只需从命令行安装它:
npm i node-sass -g
并在后台运行它: node-sass [entry path-to-file] [output-path-to-file] -w
-w
监视您的.sass 或.scss 文件中的更改并立即编译!
In your settings.json
rename the path form "\css"
to "\\css"
在您的
settings.json
。json 将路径形式"\css"
重命名为"\\css"
Like this:像这样:
{
"format": "expanded",
"extensionName": ".css",
"savePath": "\\css"
}
Don't worry it's how VS Code understands file paths.不用担心 VS Code 是如何理解文件路径的。 Not your fault:)
不是你的错:)
Refresh the main css file for every change in your child scss files (ctrl+s)为子 scss 文件中的每次更改刷新主 css 文件 (ctrl+s)
Make sure you renamed your sass main file style.scss.确保重命名 sass 主文件 style.scss。
If your sass main file have underscore before name like _style.scss, your live sass compiler will not generate.css file.如果您的 sass 主文件在名称前有下划线,例如 _style.scss,您的实时 sass 编译器将不会生成 .css 文件。
So rename your main sass file from _style.scss to style.scss.
因此,将您的主要 sass 文件从 _style.scss 重命名为 style.scss。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.