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

查看:65
本文介绍了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

推荐答案

我之前遇到过这样的问题.这是由于我对公用文件夹以及apps目录中的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.

检查并查看您是否有公用/资产文件夹,如果有并且已满,这可能就是为什么您看到双重文件夹的原因.

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天全站免登陆