heroku assets.compile=true

I made a basic rails app with a simple pages controller with an index function and when I load the page I get:


ActionView::Template::Error (application.css isn't precompiled):
    2: <html>
    3: <head>
    4:   <title>Demo</title>
    5:   <%= stylesheet_link_tag    "application" %>
    6:   <%= javascript_include_tag "application" %>
    7:   <%= csrf_meta_tags %>
    8: </head>
  app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__43625033_88530400'


Gemfile


source 'http://rubygems.org'


gem 'rails', '3.1.0'


# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'


gem 'sqlite3'


gem 'execjs'
gem 'therubyracer'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end


gem 'jquery-rails'


# Use unicorn as the web server
# gem 'unicorn'


# Deploy with Capistrano
# gem 'capistrano'


# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'


group :test do
  # Pretty printed test output
  gem 'turn', :require => false
end


ruby-on-rails asset-pipeline
link|improve this question

edited Dec 21 '11 at 4:41
richardsun
923312

asked Sep 1 '11 at 19:43
Chris Muench
2,0911824


84% accept rate

1  

bundle exec rake assets:precompile seems to fix it, but why doesn't it just work? – Chris Muench Sep 1 '11 at 20:26
1  

I have the same problem in production, even after run bundle exec rake assets:precompile – Lucas Renan Sep 4 '11 at 22:03
feedback
7 Answers
active oldest votes
up vote 95 down vote accepted



By default Rails assumes that you have your files precompiled in the production environment, if you want use live compiling (compile your assets during runtime) in production you must set the config.assets.compile to true.


# config/environments/production.rb
...
config.assets.compile = true
...


You can use this option to fallback to Sprockets when you are using precompiled assets but there are any missing precompiled files.


If config.assets.compile option is set to false and there are missing precompiled files you will get an "AssetNoPrecompiledError" indicating the name of the missing file.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值