需要为Heroku配置什么以处理基于CoffeeScript的模板? [英] What needs to be configured for Heroku to handle templates based on CoffeeScript?

查看:120
本文介绍了需要为Heroku配置什么以处理基于CoffeeScript的模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个处理AJAX请求的创建操作。在我的开发机器上,名为create.js.coffee的模板已成功处理,以生成JavaScript响应。但是,当我部署到Heroku时,应用程序抱怨它找不到模板。

  ActionView :: MissingTemplate模板/费用/使用{:handlers => [:erb,:builder],:formats => [:js,:html],:locale => [:en,:en]}创建搜索: 
*/ app / app / views
*/ app
*/
):

很明显,咖啡处理程序不是预处理* .js.coffee模板。



任何人都可以建议我如何配置Heroku来识别和处理这些模板?



注意: :Heroku正在成功预处理资产管道中的CoffeeScript档案。

解决方案晚到聚会,但这里是我的解决方案,发布在 Github






我遇到了一个问题,其中我的 create.js.coffee 文件工作开发但停止在生产(在Heroku)上工作。日志显示Rails甚至不寻找咖啡处理程序:

  2011-10-14T08:26:29 + 00 :00 app [web.1]:ActionView :: MissingTemplate(缺少模板page_blocks / create,application / create with {:handlers => [:erb,:builder,:haml],:formats => [:html, :text,:js,:css,:ics,:csv,:xml,:rss,:atom,:yaml,:multipart_form,:url_encoded_form,:json],:locale => [:nl,:nl] 。搜索范围:
2011-10-14T08:26:29 + 00:00应用[web.1]:*/ app / app / views
2011-10-14T08:26:29 +00:00应用程式[web.1]:):

我的Gemfile:

  group:assets do 
gemsass-rails 〜> 3.1.0
gemcoffee-rails,〜> 3.1.0
gemuuglifier
gemcompass,〜> 0.12.alpha
end

#asset templates
gemjquery-rails
gemhaml

只有在:assets coffee-rails c>组,事情开始工作。也许这是一个好主意在某种程度上在自述文件中清楚,甚至可以运行 coffee-rails 插件放置在资产组。


I have a create action that handles an AJAX request. On my development machine, a template named create.js.coffee is successfully processed to generate a javascript response. However, when I deploy to Heroku, the application complains that it can't find the template.

ActionView::MissingTemplate (Missing template /expenses/create with {:handlers=>[:erb, :builder], :formats=>[:js, :html], :locale=>[:en, :en]}. Searched in:
* "/app/app/views"
* "/app"
* "/"
):

It's clear that the coffee handler is not there to preprocess *.js.coffee template.

Can any one suggest how I can configure Heroku to recognize and process these templates?

Note: Heroku is successfully preprocessing my CoffeeScript files that are present in the asset pipeline.

解决方案

I'm a bit late to the party, but here is my solution, as posted on Github.


I just ran into a problem where my create.js.coffee file was working in development but stopped working in production (on Heroku). The logs show that Rails isn't even looking for a coffee handler:

2011-10-14T08:26:29+00:00 app[web.1]: ActionView::MissingTemplate (Missing template page_blocks/create, application/create with {:handlers=>[:erb, :builder, :haml], :formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json], :locale=>[:nl, :nl]}. Searched in:
2011-10-14T08:26:29+00:00 app[web.1]:   * "/app/app/views"
2011-10-14T08:26:29+00:00 app[web.1]: ):

This is the (important) part of my Gemfile:

group :assets do
  gem "sass-rails", "~> 3.1.0"
  gem "coffee-rails", "~> 3.1.0"
  gem "uglifier"
  gem "compass", "~> 0.12.alpha"
end

# asset templates
gem "jquery-rails"
gem "haml"

Only after I moved coffee-rails outside of the :assets group, things started working. Perhaps it would be a good idea to somehow make this clear in the readme, and perhaps even ship Rails with the coffee-rails plugin being placed outside the assets group.

这篇关于需要为Heroku配置什么以处理基于CoffeeScript的模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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