我刚刚使用 Ruby 1.9.2 在 Windows 7 上安装了 Compass 0.11.5。
我的开发环境设置为对所有文件使用 Unix 行尾。
我创建了一个初始的 sass-test 项目,并注意到它创建的所有文件都有 Windows 行结尾。我将现有的 .css 文件从另一个项目(带有 unix 行结尾)移动到 sass 文件夹中,并将扩展名更改为 .scss。我运行“compass compile”命令为这个新文件生成 .css 文件,并且它创建的 .css 文件具有 Windows 行结尾。
我在 Compass 文档中找不到任何配置选项来强制 Compass 生成带有 Unix 行结尾的文件。
是否可以将 Compass 配置为在 Windows 上生成带有 Unix 行结尾的文件?
更新
经过进一步调查,有一个选项可以将配置选项从 Compass 传递给 Sass。
Property Name Type Description
sass_options Hash These options are passed directly to the Sass compiler. For more details on the format of sass options, please read the sass options documentation.
Sass 有一个生成 unix 行尾的选项:
:unix_newlines
如果为 true,则在写入文件时使用 Unix 样式的换行符。仅在 Windows 上有意义,并且仅在 Sass 编写文件时(在 Rack、Rails 或 Merb 中,直接使用 Sass::Plugin 或使用命令行可执行文件时)有意义。
看来,将以下行添加到 sass-test 项目的 config.rb 文件应该可以解决问题:
sass_options = {:unix_newlines => true}
但是,它对生成的 .css 文件没有任何影响 - 它们仍然具有 Windows 行结尾。