Rails 3.1 でのテンプレート作成に EJS gem を使用しようとしています。application.js ファイルでテンプレートが必要な場合
//= require_directory ./templates
クライアント側で取得した出力は、テンプレートを匿名関数でラップして名前空間にしていますが...それだけです。これは私が得る生成された出力です。
(function() {
this.JST || (this.JST = {});
this.JST["templates/index"] = <article class="item <%=type%>">
<% if (type === "stat") { %>
<h2>
<span>70%</span>
of teens have one or more social network profiles
</h2>
<% } else { %>
<header>
<a href="/posts/<%=id%>">
<h3><%=type%></h3>
<h2><span>- <%=type%></span></h2>
</a>
</header>
<% if (confidential) { %>
<span class="confidential">Confidential</span>
<% } %>
<% if (type === "video" || type === "music") { %>
<a href="/posts/<%=id%>" class="play">play</a>
<% } %>
<a href="/posts/<%=id%>"><img src="<%=image%>" alt="" /></a>
<% } %>
</article>;
}).call(this);
テンプレートが文字列にコンパイルされることを期待しています。それは私が過去に Jammit で経験したことです。手動で行う必要がありますか? 何か不足していますか?
前もって感謝します、
あ