heroku assets.compile=true
来源:互联网 发布:java新建package 编辑:程序博客网 时间:2024/05/01 14:51
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.
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.
- heroku assets.compile=true
- compile中的force = true
- heroku
- heroku
- 解决rails部署到Heroku上时assets中css无法使用问题
- Res=Assets+Raw
- Assets
- Assets
- Spring abstract="true" merge="true"
- auto_now_add=True和auto_now_add=True
- heroku部署
- HeroKu入门
- HeroKu 试用
- heroku使用
- Heroku工具
- heroku command
- Heroku+Wordpress
- elipse retarget="true"
- 用3个步骤实现响应式Web设计
- SRM534-div1-1-div2-2-EllysCheckers
- IIS启用HTTP压缩图文教程
- Keil编译时出现 Error:Failed to execute 'BIN40/Armcc'
- 在UITextField的光标处插入文本(iOS3.0)
- heroku assets.compile=true
- c++:strcat潜在的错误不报告
- xcode -all_load、-ObjC
- tomcat几个功能的配置方法
- Iphone——使用SQLite3进行简单的数据库操作
- Linux字符集的修改方法
- 避免Android开发中的ANR
- poj 1065Wooden Sticks (简单的贪心)
- java实现将ZIP压缩文件解压的工具类