【问题标题】:inconsistent indentation while using sass使用 sass 时缩进不一致
【发布时间】:2014-07-10 10:40:23
【问题描述】:

我正在为 sass 使用 scss 格式(我正在使用括号)。当我使用 watch 命令(sass --watch “我拥有所有 sass 文件的文件夹”)时,我收到以下错误消息:

error sass (Line 37: Inconsistent indentation: 2 spaces were used for indentation, but the rest of the document was indented using 8 spaces.)

行号是否与生成的 css 文件、scss 文件或其他文件中的行号相对应(我将部分内容包含在我的 base.scss 文件中)。

base.scss 文件中的第 37 行以与其他行相同的方式缩进。

   font-family: Arial;

【问题讨论】:

  • 更新:我看错了文件夹。我现在对 scss 文件没有任何问题。

标签: sass


【解决方案1】:

Pilot 错误:我在错误的文件夹上使用了 watch 命令。切换到正确的文件夹后,我能够编译 sass 文件。

【讨论】:

  • 我在 sass 4.0 中也遇到了同样的问题 - 我在 project/css/ 文件夹中调用了它,并且遇到了那些没有任何意义的奇怪缩进错误。在 project/ 中调用 sass --watch css:css 使其正常工作。
【解决方案2】:

如果您使用现有文件中的新代码,您需要确保将文本编辑器选择为“标签大小”(在 Brackets IO 中,您可以在文本编辑器的右下方找到它) .我在文本编辑器中从“空格”更改为“标签大小”,它对我有用。

【讨论】:

    【解决方案3】:

    正如错误所说

    Line 37: 2 spaces were used, but the rest uses 8 spaces.
    

    所以如果你正在写作:

    p color: black

    你会看到在“color: black”之前有2个空格 但是您的其他代码有 8 个空格

    a color: black 确保每个人都有相同大小的空格。

    您可以在编写选择器(“p”或“a”等)后简单地使用[enter]键一次

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-27
      • 1970-01-01
      • 2017-01-25
      • 2012-10-10
      • 2011-08-06
      • 2016-05-26
      • 2015-08-28
      • 1970-01-01
      相关资源
      最近更新 更多