lib/linner/wrapper.rb in linner-0.5.0 vs lib/linner/wrapper.rb in linner-0.5.1
- old
+ new
@@ -1,32 +1,39 @@
module Linner
module Wrapper
class Module
def self.wrap(name, content)
- <<-WRAPPER
+<<-WRAPPER
this.require.define({"#{name}":function(exports, require, module){#{content};}});
- WRAPPER
+WRAPPER
end
def self.definition
File.read(File.join File.dirname(__FILE__), "../../vendor", "require_definition.js")
end
end
class Template
def self.wrap(name, content)
- <<-WRAPPER
+<<-WRAPPER
templates["#{name}"] = template(#{content});
- WRAPPER
+WRAPPER
end
+ def self.partial_wrap(name, content)
+<<-PARTIAL
+Handlebars.registerPartial("#{name}", Handlebars.template(#{content}));
+PARTIAL
+ end
+
+
def self.definition(content)
- <<-DEFINITION
+<<-DEFINITION
(function() {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
#{content}
})();
- DEFINITION
+DEFINITION
end
end
end
end