【问题标题】:Why is this fundamental SASS file not compiling?为什么这个基本的 SASS 文件没有编译?
【发布时间】:2020-07-13 20:19:12
【问题描述】:

这是 .sass 文件:

/* Welcome to Compass.
 *
 * ie.sass
 *
 * Use this file to write IE specific override styles.
 *
 * Import this file using the following HTML or equivalent:
 * <!--[if IE]>
 *   <link rel="stylesheet" type="text/css"
 *         href="/stylesheets/ie.css" media="screen, projection" />
 * <![endif]-->
 */

html {
    font-size: 24px;
}

这里是考拉产生的错误:

/*
Error: Invalid CSS after "html ": expected selector, was "{"
        on line 14 of /Users/johnlove/Sites/www.lovetoteach.dev/Web_Site_Storage/lovesongforever.com/coronavirus/Coronavirus_Support/sass_test/ie_test.sass

9:  *   <link rel="stylesheet" type="text/css"
10:  *         href="/stylesheets/ie.css" media="screen, projection" />
11:  * <![endif]-->
12:  *\/
13:  
14: html {
15: 
16: }

我已经确定所有属性都缩进一次。我还删除了{} 和尾随分号。

同样的错误!

为什么?

【问题讨论】:

    标签: compass-sass


    【解决方案1】:

    答案是即使是常驻的 sass 编译器也要求输入的 sass 文件没有{} 或结尾的;

    所以,当我消除两者时,sass 编译器会注册成功。

    我认为有或没有{} 和有或没有; 都可以接受?

    我已经回答了我原来的问题,只是用不同的问题替换它?

    我终于强迫自己决定我最喜欢哪个。很明显,我更喜欢 SASC,因为我更喜欢 {} 而不是 SASS 的缩进语法。不太关心分号,但我讨厌依赖缩进。

    所以 SASC 获胜还因为只需将文件扩展名从 .css 更改为 .sasc 就可以使新命名的 .sasc 编译为 SASC 文件

    【讨论】:

      猜你喜欢
      • 2021-10-05
      • 2022-07-07
      • 1970-01-01
      • 2022-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多