Rails 3.2 资产管道 - 不适用于图像,但适用于指南针

发布于 2025-01-08 15:29:53 字数 1670 浏览 4 评论 0原文

我经历了指南针 3.2 的痛苦,我以为我在一个月左右的时间里它工作得很好,

但奇怪的是我的图像看起来很不稳定。他们将连续工作一天,我会在第二天醒来并启动 webrick 时编写一些代码,但图像不会出现。

我的 Compass/Sass 都工作得很好,部分/插件以及所有这些优点。但我几乎每天开始工作时都会注意到这一点。我的图像不会显示在我的“开发”webrick 环境中

我的日志显示

Started GET "/assets/home/sms.png" for 127.0.0.1 at 2012-02-23 07:22:55 -0500 服务资产 /home/sms.png - 200 OK(8ms)

或偶尔...

在 2012-02-23 08:01:27 -0500 开始获取 127.0.0.1 的“/assets/home/sms.png” 服务资产 /home/sms.png - 304 Not Modified (0ms)

但它是一个 0Byte 文件。

我通常会尝试 rake asset:clean:all RAILS_ENV=development RAILS_GROUPS=assets

我通常会尝试增加 config/application.rb 中的 config.assets.version= '3'

经过几次随机尝试..图像开始出现。但我不知道有什么魔力..

我还删除了公共/图像和其他子文件夹..

你有什么想法/建议吗?真的扼杀了我的生产力。我应该提到当图像不起作用/指南针继续像魅力一样工作

this my application.rb

42 config.filterparameters += [:password]
43 config.assets.enabled = true
44 config.sass.line_comments = false
45 config.sass.syntax = :nested
46 #config.assets.precompile << /(^[^]|\/[^])[^\/]*/
47 #http://blog.55minutes.com/2012/01/getting-compass-to-work-with-rails-31-and-32/

48 config.assets.precompile << /(^[^\/]|\/[^_])[^\/]*$/
49 config.sass.preferred_syntax = :sass
50 config.assets.version= '3'

this is my gemfile.rb

45 group :production do
46 # gem 'thin'
47 end
48
49 group :assets do
50 gem 'tilt', :git => 'git://github.com/rtomayko/tilt.git'
51 gem 'sass-rails', '~>3.2.0'
52 gem 'coffee-rails'
53 gem 'uglifier'
54 gem 'compass', '~> 0.12.alpha'
55 gem 'compass-susy-plugin', :require => 'susy'
56 gem 'compass-960-plugin'
57 gem 'fancy-buttons'
58 end

任何帮助将不胜感激,哦,是的..我清除了我的浏览器缓存

I went through the compass 3.2 pain and I thought i had it working beautifully a month or so back

However oddly my images seem flaky. They will work for a day straight, I will crank some code the next day i wake up and fire up webrick and the images dont appear.

My Compass/Sass all works beautifully partials/plugins and all that goodness. But I notice almost daily that when I start work. My images wont show up on my "development" webrick environment

My log says

Started GET "/assets/home/sms.png" for 127.0.0.1 at 2012-02-23 07:22:55 -0500
Served asset /home/sms.png - 200 OK (8ms)

or occasionally...

Started GET "/assets/home/sms.png" for 127.0.0.1 at 2012-02-23 08:01:27 -0500
Served asset /home/sms.png - 304 Not Modified (0ms)

But its a 0Byte file.

I usually try a
rake assets:clean:all RAILS_ENV=development RAILS_GROUPS=assets

and I usually try incrementing
config.assets.version= '3' in the config/application.rb

And after a few random attempts.. images start to appear. BUT i have no clue what the magic is..

I also have deleted the public/images and other sub folders..

Do you have any thoughts/recommendations? Really killing my productivity. I should mention when images are not working /Compass continues to work like a charm

this my application.rb

42 config.filterparameters += [:password]
43 config.assets.enabled = true
44 config.sass.line_comments = false
45 config.sass.syntax = :nested
46 #config.assets.precompile << /(^[^]|\/[^])[^\/]*/
47 #http://blog.55minutes.com/2012/01/getting-compass-to-work-with-rails-31-and-32/

48 config.assets.precompile << /(^[^\/]|\/[^_])[^\/]*$/
49 config.sass.preferred_syntax = :sass
50 config.assets.version= '3'

this is my gemfile.rb

45 group :production do
46 # gem 'thin'
47 end
48
49 group :assets do
50 gem 'tilt', :git => 'git://github.com/rtomayko/tilt.git'
51 gem 'sass-rails', '~>3.2.0'
52 gem 'coffee-rails'
53 gem 'uglifier'
54 gem 'compass', '~> 0.12.alpha'
55 gem 'compass-susy-plugin', :require => 'susy'
56 gem 'compass-960-plugin'
57 gem 'fancy-buttons'
58 end

Any help would be appreciated and oh yes..i cleared my browser cache

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

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

发布评论

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

评论(1

讽刺将军 2025-01-15 15:29:53

长度为零字节的图像听起来可疑地类似于 action_dispatch.x_sendfile_header (通常只在 生产.rb 中找到),其中 Rails 发送特殊的 X-SendfileX-Accel-Redirect 标头用于 Web 服务器,而不是提供图像数据本身。使用 Safari 或 Chrome 的 Web Inspector 等工具,检查随零字节图像返回的标头。如果存在这些特殊标头,则可能意味着您错误地将特定于生产的设置包含到开发配置中。

Images of zero bytes in length sounds suspiciously like the behavior controlled by action_dispatch.x_sendfile_header (normally only found in production.rb), where Rails sends a special X-Sendfile or X-Accel-Redirect header intended for the web server, rather than serving the image data itself. Using a tool like Safari or Chrome's Web Inspector, check the headers being returned with the zero-byte image. If these special headers are there, it could mean that you've mistakenly included production-specific settings into your development config.

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