是否可以使用 Rails Asset Pipeline 强制生成资产?
使用 Rails 3.1 Asset Pipeline 时,是否有办法强制每次请求重新生成资产?
当我将 Less (less-rails) 与一系列部分文件和 mixin 文件一起使用时,让系统获取文件更改时遇到问题。如果我可以强制系统根据每个请求进行生成,我的工作效率会更高。
Is there a way to force regeneration of assets every request when using the Rails 3.1 Asset Pipeline?
I am having problems getting the system to pick up changes to files when using Less (less-rails) with a series of partials and mixin files. If I could just force the system to generation on each request I would be much more productive.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要强制所有资产完全重新生成,请使用:
当 asset_sync 与您不公平时非常方便......
To force a complete regeneration of all assets use:
Very handy when asset_sync isn't playing fair with you...
您可以使用以下命令重置资源缓存
You can reset the assets cache with
您必须在
开发
环境中运行服务器。我认为您还可以在当前环境的配置文件中使用类似 config.cache_classes = false 的内容。You have to run your server in the
development
environment. I think you can also use something likeconfig.cache_classes = false
in your current environment's config file.我解决了。
master.less 文件(如协调其他包含文件的主 less 文件)需要添加管道指令。
所以就我而言, application.css 包含:
并且 master.css.less 包含:
I worked it out.
The master.less file (as in the main less file that coordinates the other include files) needed to have the pipeline directives added to it.
So in my case, application.css contains:
And master.css.less contains: