Sha256: 03c12a982b666b6e5868781654184f077b01582bb3ac04b7cfeb1c2f22db43ab

Contents?: true

Size: 793 Bytes

Versions: 2

Compression:

Stored size: 793 Bytes

Contents

module Golf
  class Compiler

    def initialize(golfpath = "golfapp/components")
      @golfpath = golfpath
    end

    def generate_componentsjs
      puts "compiling components in #{@golfpath}..."
      component_preamble = 'jQuery.golf.components='
      components = {}
      if File.exists?(@golfpath) and File.directory?(@golfpath)
        Dir["#{@golfpath}/**/*.html"].each do |path|
          name = path.split('/').last.gsub('.html','')
          html = File.read(path)
          components = components.merge({ name => { "name" => name, "html" => html }})
        end
      end
      component_preamble << JSON.dump(components) << ';' << 'jQuery.golf.res={};jQuery.golf.plugins={};jQuery.golf.scripts={};jQuery.golf.styles={};jQuery.golf.setupComponents();'
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
golf-0.0.9 lib/golf/compiler.rb
golf-0.0.8 lib/golf/compiler.rb