【问题标题】:Sublime Text 3 SASS Build error, cannot build a css fileSublime Text 3 SASS 构建错误,无法构建 css 文件
【发布时间】:2019-05-07 15:16:23
【问题描述】:

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

所有安装均成功: -包:SASS、SCSS、SASSBuild -SASS 使用 brew - 从 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 工作?提前致谢。

【问题讨论】:

  • 你不能使用gulpwepback 它比sublime 容易得多。

标签: css sass sublimetext3


【解决方案1】:

您也可以修复“SASS Build”插件为您带来的错误参数(例如--no-cache),而不是创建新的构建系统。

  1. 安装PackageResourceViews(让您更改包中的任何内容)
  2. 启动“PackageResourceViewer: OpenResource
  3. 选择“SASS 构建
  4. 选择“SASS.sublime-build”和/或“SASS - Compressed.sublime-build
  5. 修正错误的参数,保存并关闭
  6. 尝试打造你的 sass!

顺便说一句,这是我的构建文件;从“cmd”中删除“--no-cache”:

{
    "cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error"],
    "selector": "source.sass, source.scss",
    "line_regex": "Line ([0-9]+):",

    "osx":
    {
        "path": "/usr/local/bin:$PATH"
    },

    "windows":
    {
        "shell": "true"
    }

}

【讨论】:

    【解决方案2】:

    当您安装了 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,例如将压缩更改为扩展

    More information on Sublime Build Systems.

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-09
      • 2017-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多