You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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.css
  • savePath保持和压缩文件一致,确保两个文件都输出到/dist/css目录下

修改保存设置后,重新点击"Watch Sass",就能同时生成style.css、style.min.css和对应的map文件了。

内容的提问来源于stack exchange,提问作者xuan xose

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 19:22:04