Sha256: 6e542a262cb984b952a13f2ac273c3e5cbd9303cbdf5432bbe0807922b7190e3

Contents?: true

Size: 700 Bytes

Versions: 2

Compression:

Stored size: 700 Bytes

Contents

module Frontrunner
  module Helper
    def webpack_include_tag(*sources)
      options = sources.extract_options!
      sources =
        sources.map do |source|
          @webpack_manifest = nil if Rails.env.development?
          entry = webpack_manifest[source]
          raise Frontrunner::Error, "Could not find webpack entry point: #{source}" unless entry
          entry["js"]
        end
      javascript_include_tag *sources, options
    end

    def webpack_manifest
      @webpack_manifest ||= JSON.parse(File.read(Rails.root.join("webpack-assets.json")))
    rescue => e
      raise Frontrunner::Error, "Error reading webpack manifest - be sure to start the dev server"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frontrunner-0.1.1 lib/frontrunner/helper.rb
frontrunner-0.1.0 lib/frontrunner/helper.rb