Sha256: d54a0d6ec20fc0cc3b397ff255e71c131464675ec85ac76a5fb7f4c0272ed633

Contents?: true

Size: 855 Bytes

Versions: 17

Compression:

Stored size: 855 Bytes

Contents

# ===========================================================================
# Project:   Abbot - SproutCore Build Tools
# Copyright: ©2011 Strobe Inc.
#            and contributors
# ===========================================================================

require "sproutcore/builders/base"
require "fileutils"
require "json"

module SC

  class Builder::Handlebars < Builder::Base

    def build(dst_path)
      template_name = entry.rootname[/^.*\/([^\/]*)$/, 1]
      template_code = read(entry[:source_path])
      replace_static_url(template_code)
      writelines dst_path, "SC.TEMPLATES[#{template_name.inspect}] = SC.Handlebars.compile(#{template_code.to_json});"
    end

    def sc_static_match
      /\{\{(sc_static|static_url|sc_target)\(\s*['"]([^"']*?)['"]\s*\)\}\}/
    end

    def static_url(url='')
      url
    end

  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/sproutcore/builders/handlebars.rb
sproutcore-1.11.0.rc3 lib/sproutcore/builders/handlebars.rb
sproutcore-1.11.0.rc2 lib/sproutcore/builders/handlebars.rb
sproutcore-1.11.0.rc1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.10.3.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.10.2 lib/sproutcore/builders/handlebars.rb
sproutcore-1.10.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.10.0 lib/sproutcore/builders/handlebars.rb
sproutcore-1.10.0.rc.3 lib/sproutcore/builders/handlebars.rb
sproutcore-1.10.0.rc.2 lib/sproutcore/builders/handlebars.rb
sproutcore-1.10.0.rc.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.9.2 lib/sproutcore/builders/handlebars.rb
sproutcore-1.9.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.9.0 lib/sproutcore/builders/handlebars.rb
sproutcore-1.8.2.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.8.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.8.0 lib/sproutcore/builders/handlebars.rb