Sha256: 2f9e74116532660b6ba48b843566a1f45010848b33b1c487061c7c5c420ee80c

Contents?: true

Size: 610 Bytes

Versions: 13

Compression:

Stored size: 610 Bytes

Contents

# Based on https://github.com/josh/ruby-coffee-script
require 'execjs'
require 'pathname'

module HandlebarsAssets
  class Handlebars
    class << self
      def precompile(*args)
        context.call('Handlebars.precompile', *args)
      end

      private

      def context
        @context ||= ExecJS.compile(source)
      end

      def source
        @source ||= path.read
      end

      def path
        @path ||= assets_path.join(HandlebarsAssets::Config.compiler)
      end

      def assets_path
        @assets_path ||= Pathname(HandlebarsAssets::Config.compiler_path)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
handlebars_assets-0.11.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.10.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.9.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.8.2 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.8.1 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.8.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.7.2 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.7.1 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.7.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.6.7 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.6.6 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.6.5 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.6.4 lib/handlebars_assets/handlebars.rb