Sha256: b8fb0d81b61f123e52c6c4054534837fecfe8f68332940ec7f962aa99effcb48

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

module Linner
  module Wrapper
    class Module
      def self.wrap(name, content)
        <<-WRAPPER
this.require.define({"#{name}":function(exports, require, module){#{content};}});
        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
templates["#{name}"] = template(#{content});
        WRAPPER
      end

      def self.definition(content)
        <<-DEFINITION
(function() {
  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  #{content}
})();
        DEFINITION
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linner-0.5.0 lib/linner/wrapper.rb