【问题标题】:Rails Sass compiles too slow in a fast development machineRails Sass 在快速开发机器上编译太慢
【发布时间】:2012-11-12 20:39:32
【问题描述】:

我的电脑运行频率为 3.6ghz,内存为 12gb,并使用 Windows 7 和 RailsInstaller 来开发 Rails 应用程序。

当我使用纯 css 时,没有问题,但是当我开始使用 Sass 和 Compass 时,我必须等待 10-15 秒才能刷新才能看到新的更改。 (仅在我编辑 .scss 文件时才会发生)

谁知道在相当快的机器上是什么原因造成的?

【问题讨论】:

  • 您是否尝试过手动设置指南针手表?
  • 可能是某种适用于 Windows 的兼容性补丁是问题...任何其他 Windows 用户也有同样的问题?
  • @markus-tharkun 我不认为我可以使用带导轨的指南针手表,它说:Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
  • 我在 Mac 上遇到了同样的问题。 ruby 1.9.3p327、Rails 3.2.8、Sass 3.2.1、Compass 0.12.2、compass-rails (1.0.3)、sass-rails (3.2.5) gem list

标签: ruby-on-rails sass


【解决方案1】:

在我的情况下,这是因为过于频繁地使用 @extend 指令。

【讨论】:

    【解决方案2】:

    随着从 sass 3.1.x 更新到 3.2.x,sass 编译时间显着延长。
    根据上面 Roman 的回复,似乎有一个特定的问题,如果您在深度嵌套的选择器中使用 @extend 会引起这种情况,因为“@extend”做了很多处理工作。 Here is the link to a currently open issue on the sass project on github for this exact problem

    话虽如此,关于该问题的报告更像是 90-100 秒的编译时间(我自己的个人项目为 104 秒,它使用 @extend alot 来引入基础/引导类)。因此,如果您遇到 9-10 秒的延迟,您的问题可能只是一个普遍问题,因为最新更新的编译时间通常较慢。

    【讨论】:

      猜你喜欢
      • 2023-03-13
      • 2017-04-26
      • 1970-01-01
      • 2014-07-24
      • 1970-01-01
      • 2014-02-24
      • 2010-12-08
      • 2014-09-10
      • 1970-01-01
      相关资源
      最近更新 更多