Sha256: b2d23e6b2ac9eabf407af35c460f3d6b519c2bf3459c98b4d4a745a4333ed260

Contents?: true

Size: 830 Bytes

Versions: 33

Compression:

Stored size: 830 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.partial_wrap(name, content)
<<-PARTIAL
Handlebars.registerPartial("#{name}", Handlebars.template(#{content}));
PARTIAL
      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

33 entries across 33 versions & 2 rubygems

Version Path
linner-0.7.3 lib/linner/wrapper.rb
linner-0.7.2 lib/linner/wrapper.rb
linner-0.7.1 lib/linner/wrapper.rb
linner-0.7.0 lib/linner/wrapper.rb
linner-0.6.7 lib/linner/wrapper.rb
linner-0.6.6 lib/linner/wrapper.rb
linner-0.6.5 lib/linner/wrapper.rb
linner-0.6.4 lib/linner/wrapper.rb
linner-0.6.3 lib/linner/wrapper.rb
linner-0.6.2 lib/linner/wrapper.rb
linner-0.6.1 lib/linner/wrapper.rb
linner-0.6.0 lib/linner/wrapper.rb
linner-0.5.1 lib/linner/wrapper.rb