【问题标题】:sass --watch : could not find option named "watch"sass --watch:找不到名为“watch”的选项
【发布时间】:2022-03-26 18:16:31
【问题描述】:

简单的一个,但在网上任何地方都找不到答案!在我的 Mac 上全局安装了 sass (npm install -g sass)。

这按预期工作:

sass style.scss style.css

那我试试:

sass --watch style.scss:style.css

得到:

Could not find an option named "watch".

Usage: sass <input> [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]

-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.

我错过了什么??

谢谢!!

【问题讨论】:

    标签: npm sass


    【解决方案1】:

    最后,我放弃了上面尝试的sass,并使用webpack 寻求解决方案。

    我尝试过的另一个可行的方法是使用node-sass

    【讨论】:

    • 对于那些想知道为什么它不起作用的人,sass 包(又名Dart Sass)在根据this issue 撰写本文时还不支持--watch 参数在他们的回购中。
    【解决方案2】:

    首先创建 SASS 的文件夹,然后在其中创建您的 SASS 文件。示例:

    sass/styles.sass
    

    在您的项目根文件夹中,打开控制台并输入命令:

    sass --watch sass/styles.sass:css/styles.css
    

    此命令将创建您的 CSS 文件夹和 CSS 文件。除了为 .css 编译 .sass 内容。

    【讨论】:

      【解决方案3】:
      I solved running this command on your terminal
      

      回显 fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

      希望对你有帮助

      【讨论】:

      • 这并没有真正帮助...我遇到了另一个错误:sysctl: illegal option -- p
      猜你喜欢
      • 2019-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-22
      • 2014-08-03
      • 1970-01-01
      • 2020-05-06
      相关资源
      最近更新 更多