Heroku不会预编译我的资产,以准备我的资产管道应用程序 [英] Heroku is not pre-compiling my assets to prepare my app for asset pipeline

查看:84
本文介绍了Heroku不会预编译我的资产,以准备我的资产管道应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Rails 3.1.1让我的资产管道设置与Heroku / Cedar一起工作时遇到了一些麻烦。

我推送了我的应用程序并启动它但没有任何信息表示准备资产管道并且没有静态资产正在投放。没有JS,CSS或图像能够找到,因为没有slu comp编译时间或运行时资产编译正在完成。



任何帮助将不胜感激。

p>

它们描述了在此链接我将在下面总结:


使用Heroku Cedar上的Rails 3.1应用程序时,当您推送heroku时,您的资产将全部为通过使用rake任务包exec rake assets预编译为部署过程的一部分:precompile。


好的,解决方案是这样的:



我使用的是mongoid,它将'rails / all'行作为配置的一部分删除。因此,链轮未被加载。

您需要使用rails 3.1+的功能还包括 requiresprockets / railtie code>在application.rb中,以便启用链轮。 Boom,works。

这些信息可以在mongoid网站上找到此处。这对于知道任何可能无法在application.rb中加载完整rails / all的人很有用,资产管道工作显然需要链轮。

I'm having a bit of trouble getting my asset pipeline setup working with Heroku/Cedar using Rails 3.1.1

I've pushed my application and it launches successfully but there was no message that said "Preparing asset pipeline" and no static assets are being served up. No JS, CSS, or images are able to be found as there is no slug compilation time or runtime asset compilation being done.

Any help would be greatly appreciated.

They describe what should happen during deployment at this link which I'll summarize below:

With a Rails 3.1 application on Heroku Cedar when you git push heroku your assets will all be pre-compiled as part of the deploy process by using the rake task bundle exec rake assets:precompile.

解决方案

Ok so the solution was this:

I'm using mongoid which has you remove the 'rails/all' line as part of the configuration. As a result sprockets was not being loaded.

What you need to do with rails 3.1+ is also add require "sprockets/railtie" in application.rb so that sprockets are enabled. Boom, works.

This info can be found on the mongoid website here. This is useful to know for anyone who may not be loading the full 'rails/all' in application.rb, sprockets is obviously required for the asset pipeline to work.

这篇关于Heroku不会预编译我的资产,以准备我的资产管道应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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