简体   繁体   English

VIsual Studio 代码 - 实时 Sass 编译器未生成。css 文件位于单独的 css 文件夹中

[英]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.

相关问题 VS code live Sass 编译器不生成 css 文件 - VS code live Sass compiler not generating css file 实时 sass 编译器未生成 css 文件 - live sass compiler not generating css files 为什么我的 VS 代码直播 sass 编译器编译单独的 css 文件? - why my VS code live sass compiler compiling separate css files? 无法使用 Live Sass 编译器将 Sass 文件编译成 CSS - Can't compile Sass file into CSS with Live Sass Compiler 我为vs code安装的live sass编译器插件不在我的css文件后面? - The live sass compiler plugin I installed for vs code does not follow my css file? 在实时 sass 编译器中编译时出现 Sass 无效 css 错误 - Sass invalid css error on compile in live sass compiler 当我运行 VSCode 的 sass 实时编译器时,我如何获得 CSS 文件夹? - How can ı get CSS Folder when ı run sass live compiler of VSCode? 问题 - Visual Studio Code 中的实时复杂功能 SCSS 到 CSS(背景图片) - Issue - Live complication Scss to CSS in Visual Studio Code (Background image) 在 Visual Studio 的构建定义中包含 SASS 编译器? (并避免在使用 TFS 时合并 CSS 文件) - Include SASS compiler in build definition in Visual Studio? (and avoid merging the CSS files when using TFS) 在 SCSS 中使用 CSS 变量会引发语法错误(SASS Live Compiler) - Using CSS vars in SCSS throws syntax error (SASS Live Compiler)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM