Sublime Text 3 SASS Build错误,无法生成CSS文件

时间:2018-12-06 00:07:43

标签: css sass sublimetext3

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

所有安装均成功: -软件包:SASS,SCSS,SASSBuild -使用酿造的SASS -从Mac预装Ruby

当我尝试用保存在台式机/ SCSS上的style.scss进行“工具”->“构建”->“ SASS”时,它显示此消息,但没有任何反应:

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正常工作?预先感谢。

1 个答案:

答案 0 :(得分:1)

当您安装了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 ),然后从菜单中将其选择为构建系统。