为什么 Asset Pipeline 尝试压缩我的 CSS 两次(或根本不压缩)?

发布于 2024-12-08 11:42:37 字数 703 浏览 7 评论 0原文

将我们的 Compass 支持的应用程序升级到 Rails 3.1.1.rc1 和 Asset Pipeline 后,我在尝试本地预编译样式表时开始收到“regexp 缓冲区溢出”错误。我发现 ScssCompressor 正在接收已经预编译的样式表,因此无法处理更复杂的正则表达式(大概是由 Compass 编译的)。

为了防止这种行为,我禁用了 Scss 压缩,并且我观察到样式表在预编译步骤中被压缩。 (我已经在 sass-rails Github Issue #63 上详细解释了这一点 )。

然而,当我使用提供的 Capistrano 部署/资产配方将应用程序部署到临时服务器时,我注意到样式表现在根本没有被压缩(尽管它们已正确预编译)。

任何有关如何解决此问题或在哪里寻求帮助的想法将不胜感激。

Bundle:

  • rails 3.1.1.rc1(rc2有其他问题)
  • compass master分支(0.12.alpha有其他问题)
  • sass-rails 3.1.4
  • sprockets 2.0.2

更新:回答第二部分问题:Compass 未配置为压缩临时环境的样式表(默认仅用于生产),因此流程本身没有差异。

After upgrading our Compass-powered app to Rails 3.1.1.rc1 and Asset Pipeline, I've started getting "regexp buffer overflow" error when trying to precompile stylesheets locally. I've discovered that ScssCompressor was receiving already precompiled stylesheet and thus failing on a more complex regexp (presumably compiled by Compass).

To prevent this behavior, I disabled Scss compression and I observed stylesheets getting compressed in precompile step. (I've explained this in more details on sass-rails Github Issue #63).

However, when I deployed the app to our staging server using the provided Capistrano deploy/assets recipe I noticed that stylesheets now don't get compressed at all (they are precompiled correctly though).

Any ideas as to how to fix this or where to look for help would be appreciated.

Bundle:

  • rails 3.1.1.rc1 (rc2 has other problems)
  • compass master branch (0.12.alpha has other problems)
  • sass-rails 3.1.4
  • sprockets 2.0.2

UPDATE: to answer the second part of the question: Compass was not configured to compress stylesheets for staging environment (default is just for production), so there is no difference in the flow itself.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与酒说心事 2024-12-15 11:42:37

因为链轮希望将压缩作为一个单独的步骤。也许有一些优化。请提交针对 sass-rails 的错误,我们将进行调查。

because sprockets wants to have compressions as a separate step. Perhaps there's some optimizations. please file a bug against sass-rails and we'll investigate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文