Sha256: e061a1dca112219746c5c444ad5778d0a0d0ad4c28945748e2ec813b8c7e5f9b

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

# Render the config/base/index.html when precompiling.  Here we only render
# one js and one css file.

module Volt
  class BaseIndexRenderer
    def initialize(volt_app, manifest)
      @volt_app = volt_app
      @manifest = manifest
    end

    def html
      index_path = File.expand_path(File.join(Volt.root, 'config/base/index.html'))
      html       = File.read(index_path)

      ERB.new(html, nil, '-').result(binding)
    end

    # When writing the index, we render the
    def javascript_tags
      "<script async src=\"#{@volt_app.app_url}/#{@manifest['assets']['main/app.js']}\"></script>"
    end

    def css_tags
      "<link href=\"#{@volt_app.app_url}/#{@manifest['assets']['main/app.css']}\" media=\"all\" rel=\"stylesheet\" type=\"text/css\" />"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
volt-0.9.5.pre12 lib/volt/cli/base_index_renderer.rb
volt-0.9.5.pre11 lib/volt/cli/base_index_renderer.rb
volt-0.9.5.pre9 lib/volt/cli/base_index_renderer.rb
volt-0.9.5.pre8 lib/volt/cli/base_index_renderer.rb