观看 SCSS 不断创建 index.css

Watch SCSS keeps creating an index.css

我是 SCSS 的新手,我正在使用 VS Code 的扩展来查看我的 SCSS,我已经设置了我的 settings.json 文件并且一切正常 - 但是 - 当我查看我的 SCSS 文件和保存,它会创建两个 .css 文件。

Index.css 是一个空的 .css 文件

Main.css 是一个 .css 文件,其中包含我所有的样式。

为什么它一直在生成空的 index.css 文件?

这是我的 settings.json 文件的内容,可以提供一些帮助。

{
    "editor.accessibilitySupport": "off",
    "window.zoomLevel": 0,
    "liveServer.settings.donotShowInfoMsg": true,
    "liveServer.settings.donotVerifyTags": true,
    "[html]": {
        "editor.defaultFormatter": "HookyQR.beautify"
    },
    "[javascript]": {
        "editor.defaultFormatter": "HookyQR.beautify"
    },
    "workbench.iconTheme": "material-icon-theme",
    "editor.minimap.enabled": false,
    "javascript.updateImportsOnFileMove.enabled": "always",
    "workbench.colorTheme": "Night Owl",
    "[json]": {
        "editor.defaultFormatter": "vscode.json-language-features"
    },
    // "python.jediEnabled": false,
    "[python]": {

    },
    "editor.fontFamily": "Input",
    "editor.fontSize": 16,
    "[php]": {
        "editor.defaultFormatter": "kokororin.vscode-phpfmt"
    },
    "liveSassCompile.settings.autoprefix": [],
    "liveSassCompile.settings.formats": [
        {
            "format": "compact",
            "extensionName": ".css",
            "savePath": "/dist/assets/css"
        }
    ],
    "liveSassCompile.settings.generateMap": false
}

我明白了为什么会这样,所以我会post解释一下以帮助遇到类似问题的人。

我创建了一个部分,但没有在它前面添加 _。

这是我的文件夹结构,我的文件命名错误:

- scss
    - pages
        - pages.scss

这是我的文件夹结构,我的文件命名正确:

- scss
    - pages
        - _pages.scss

希望对您有所帮助。