Sha256: ed7a4f6448ed85faf607b35e6d7ecbc724a8b50c10a8a536b18b8ce524ef0238

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'find'
require 'barber'

module Emberprecompile
    class Compiler
        def self.compile
            fileName = "compiled/views.handlebars.js"
            source = "views/"
            output = File.new(fileName, "w")
            
            Find.find(source) do |file|
                if !FileTest.directory?(file)
                    print "Compiling "+file
                    templateName = file.chomp(".handlebars")
                    templateName.slice!(source)
                    result = Barber::Ember::FilePrecompiler.call(File.read(file))
                    output.write('/* '+ templateName + ' Handlebar */')
                    output.puts @string
                    output.write('Ember.TEMPLATES["' + templateName + '"] = ' + result + '')
                    output.puts @string
                    print "\n"
                else
                    next
                end
            end
            print "\n"
            print "Pre-Compiled handlebars are ready for use....\n-------------------------------------------------------\n"
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
emberprecompile-0.1.1 lib/emberprecompile/compiler.rb
emberprecompile-0.1.0 lib/emberprecompile/compiler.rb