css - Sublime Text 3 SASS 构建错误,无法构建 css 文件

标签 css sass sublimetext3

我在 Sublime Text3 上使用 SASSBuild 将 style.scss 保存为嵌套的 .css,但一直失败,退出代码为 64。

所有安装都成功: -包:SASS、SCSS、SASSBuild -SASS 使用 brew -从 Mac 预装 Ruby

当我尝试 Tools->Build->SASS with style.scss saved on desktop/SCSS 时,它显示此消息但没有任何反应:

Could not find an option named "cache".

Usage: sass <input.scss> [output.css]
       sass <input.scss>:<output.css> <input/>:<output/>

━━━ Input and Output ━━━━━━━━━━━━━━━━━━━
    --[no-]stdin               Read the stylesheet from stdin.
    --[no-]indented            Use the indented syntax for input from stdin.
-I, --load-path=<PATH>         A path to use when resolving imports.
                               May be passed multiple times.

-s, --style=<NAME>             Output style.
                               [expanded (default), compressed]

    --update                   Only compile out-of-date stylesheets.

━━━ Source Maps ━━━━━━━━━━━━━━━━━━━━━━━━
    --[no-]source-map          Whether to generate source maps.
                               (defaults to on)

    --source-map-urls          How to link from source maps to source files.
                               [relative (default), absolute]

    --[no-]embed-sources       Embed source file contents in source maps.
    --[no-]embed-source-map    Embed source map contents in CSS.

━━━ Other ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    --watch                    Watch stylesheets and recompile when they change.
    --[no-]poll                Manually check for changes rather than using a native watcher.
                               Only valid with --watch.

    --[no-]stop-on-error       Don't compile more files once an error is encountered.
-i, --interactive              Run an interactive SassScript shell.
-c, --[no-]color               Whether to emit terminal colors.
-q, --[no-]quiet               Don't print warnings.
    --[no-]trace               Print full Dart stack traces for exceptions.
-h, --help                     Print this usage information.
    --version                  Print the version of Dart Sass.
[Finished in 0.1s with exit code 64]
[cmd: ['sass', '--update', '/Users/adrian/Desktop/SCSS/style.scss:/Users/name/Desktop/SCSS/style.css', '--stop-on-error', '--no-cache']]
[dir: /Users/name/Desktop/SCSS]
[path: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]

如何让 SASSBuild 工作?提前致谢。

最佳答案

当您安装了 Dart SASS(这是较新的首选模块)而不是 Node SASS 时,会发生此错误。内置脚本使用 --no-cache 选项,该选项在 Dart SASS 模块中不存在。

您可以轻松添加自己的构建文件来代替内置的:

在 Sublime 中,选择

Tools > Build System > New Build System...

这将在您的 Sublime User 文件夹中打开一个新文件。使用以下脚本:

{ 
    "cmd" : [
        "sass", 
        "--update", 
        ".:.", 
        "--stop-on-error", 
        "--style", 
        "compressed"
    ],
    "selector": "source.scss"
}

您可以设置任何 Dart SASS options例如,将 compressed 更改为 expanded

More information on Sublime Build Systems .

然后,只需保存此文件(可能是 Dart-SASS.sublime-build),然后从菜单中选择它作为您的构建系统。

关于css - Sublime Text 3 SASS 构建错误,无法构建 css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53642701/

相关文章:

sublimetext3 - 在 Sublime 3 中忽略文件搜索中的 node_modules

typescript - Sublime Typescript 撤消构建文件

html - 在 <select> 旁边显示 <span>

css - 为什么我的表单文本字段中的文本是灰色的?

jquery - 如何编写 5 态切换链接

css - SCSS - 作为 parent 的第 n 个 child ?

jquery - div 在另一个 div 之上,但应该滚动到后一个 div 之下

javascript - 在 ES6 中加载 SASS 变量

angular - 使用打开的图标包引用 .scss 时生成错误

build - 崇高文本3 : how to create a build system?