Sha256: a68f4f61d6a38860e6d30d66d32b0abae129c1a3cbe810816ec8750aa81d519e

Contents?: true

Size: 770 Bytes

Versions: 3

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

module LB
  module Project
    # Site context for templates
    class Site
      include R18n::Helpers

      def initialize(context = {})
        @context = context
      end

      def options
        @options ||= {}
      end

      def [](*args)
        options.fetch(*args)
      end

      def path_for(bundle, type)
        path = 'webpack-assets.json'
        file = File.read(path)
        json = JSON.parse(file)
        LB::Project.config.base_path + json[bundle][type]
      end

      def js_for(bundle)
        path_for(bundle, 'js')
      end

      def css_for(bundle)
        path_for(bundle, 'css')
      end

      def image_path(path)
        "#{LB::Project.config.image_base_path}/#{path}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lb-project-0.1.1 lib/lb/project/site.rb
lb-project-0.1.0 lib/lb/project/site.rb
lb-project-0.0.1 lib/lb/project/site.rb