Sha256: d1ff94ae9a2ded41c92a1b95130376fdf6bbe3b83d88c5672920b535d79c79df
Contents?: true
Size: 791 Bytes
Versions: 3
Compression:
Stored size: 791 Bytes
Contents
require 'volt/server/rack/component_files' # Serves the main pages class IndexFiles def initialize(app, component_paths) @app = app @component_paths = component_paths end def call(env) if %w[/ /demo /blog /todos /page3 /page4].include?(env['PATH_INFO']) || env['PATH_INFO'][0..5] == '/todos' [200, { 'Content-Type' => 'text/html' }, [html]] else @app.call env end end def html index_path = File.expand_path(File.join(Dir.pwd, "public/index.html")) html = File.read(index_path) ERB.new(html).result(binding) end def javascript_files # TODO: OPTimize ComponentFiles.new('home', @component_paths).javascript_files end def css_files ComponentFiles.new('home', @component_paths).css_files end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
volt-0.2.7 | lib/volt/server/rack/index_files.rb |
volt-0.2.5 | lib/volt/server/rack/index_files.rb |
volt-0.2.4 | lib/volt/server/rack/index_files.rb |