VS Code中Watch Sass仅生成压缩CSS,需恢复设置及生成普通CSS
解决Live Sass Compile仅生成压缩CSS文件的问题
你需要在liveSassCompile.settings.formats数组中添加一个新的格式配置项,来生成未压缩的style.css文件。修改后的完整设置如下:
{ "workbench.colorTheme": "Default Dark+", "git.autofetch": true, "git.confirmSync": false, "liveServer.settings.enableBrowserRefresh": false, "liveServer.settings.donotShowInfoMsg": true, "git.enableSmartCommit": true, "liveServer.settings.ChromeDebuggingAttachment": false, "liveServer.settings.CustomBrowser": "firefox", "[python]": { "editor.formatOnType": true }, "liveSassCompile.settings.formats": [ { "format": "compressed", "extensionName": ".min.css", "savePath": "/dist/css" }, { "format": "expanded", "extensionName": ".css", "savePath": "/dist/css" } ], "editor.formatOnSave": true }
- 新增的配置项中,
format: "expanded"会生成结构清晰、保留换行和缩进的未压缩CSS文件;如果需要更紧凑的未压缩格式,也可以换成"nested" extensionName: ".css"指定生成的文件后缀为.css,对应你需要的style.csssavePath保持和压缩文件一致,确保两个文件都输出到/dist/css目录下
修改保存设置后,重新点击"Watch Sass",就能同时生成style.css、style.min.css和对应的map文件了。
内容的提问来源于stack exchange,提问作者xuan xose
相关产品推荐
相关产品推荐

