0

これは私のサンプル JST ファイルです

(function() {
  var _ref;

  if ((_ref = window.JST) == null) {
    window.JST = {};
  }

 window.JST['test'] = function(context) {
   return (function() {
   var $o;

  $o = [];
  $o.push("<h1>yayyyyyyaa</h1>");
  return $o.join("\n");
 }).call(context);
};

}).call(this);

次のように、バックボーンアプリでrequire.jsを使用します

define ['backbone', 'marionette', 'text!javascripts/backbone/templates/test.jst'],    
(Backbone, Marionette, template) ->

   class Test extends Backbone.Marionette.ItemView
       template: JST[template]

アプリをロードすると、次のようになります。

ReferenceError: JST is not defined

なぜああなぜ!

ありがとう!

4

1 に答える 1