开发中的 rails 3.1 资产管道 css 缓存 [英] rails 3.1 asset pipeline css caching in development

查看:26
本文介绍了开发中的 rails 3.1 资产管道 css 缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点困惑,因为 application.css 似乎包含了自己两次,一次是在它列出清单中的资源时,然后是它的缓存.因此,当我删除单个文件时,它似乎仍然在 application.css 文件中保持活动状态.

I'm a bit confused as it seems like the application.css is including itself twice, once when it lists the resources from the manifest and then a cache of that. So when I delete an individual file it still seems to stay alive inside the application.css file.

/*
*= require twitter/bootstrap
*= require_self
*= require_tree ./common
*= require_tree ./helpers
*/

按预期工作并在开发模式下输出所有相关的单个文件

Which works as expected and outputs in dev mode all the relevant individual files

  # Do not compress assets
  config.assets.compress = false

  # Expands the lines which load the assets
  config.assets.debug = true

输出

<link href="/assets/twitter/bootstrap.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/application.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/common/announcement.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/common/button.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<Blah blah>

application.css(输出)

这应该是空白的?因为我在 application.css 文件中只有清单,没有实际的 css,但我得到了所有 106kb 长的连接代码.

application.css (output)

This should be blank? Since all I have in my application.css file is the manifest and no actual css but instead i get all my concatenated code 106kb long.

IE 如果我删除公共目录中的文件,它不会消失.它不再在输出中列出,但 css 仍然出现在 application.css

IE if I remove a file in the common directory, it doesn't go away. It is no longer listed in the output but the css still appears from the application.css

推荐答案

我以前也遇到过这样的问题.这是在我预编译了公用文件夹和应用程序目录中的 applcation.css 之后的资产之后引起的.我不知道如何修复它,以便在开发模式下它不会继续发生,但是如果您删除 /public/assets 目录,它应该修复它.

I had a problem like this before. It was caused after I had precompiled the assets it was going after the applcation.css inside the public folder as well as in the apps directory. I'm not sure how to fix it so that it doesn't keep happening while in dev mode but if you delete your /public/assets directory it should fix it.

检查您是否有一个 public/assets 文件夹,如果有并且它已满,这可能就是您看到双倍的原因.

Check and see if you have a public/assets folder, if you do and it's full, it's probably why you're seeing double.

这篇关于开发中的 rails 3.1 资产管道 css 缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆