Sha256: e3e1d69b8758901ebd8a0505e440f66493d821fc0a90be904e02237227720f2c

Contents?: true

Size: 697 Bytes

Versions: 4

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true

module ViewComponentScopedCss
  #
  # Resolve css module naming after loading and compiling scss files to provide final css
  #
  class Loader
    # class_attribute :compile_options, default: { source_map: true, style: { output: :compressed } }

    def initialize(view_component_class)
      @identifier = view_component_class.name.sub("::Component", "").underscore.split("/").join('\:\:')
      @path = "app/components#{view_component_class.virtual_path}.scss"
    end

    def call
      ViewComponentScopedCss::Compiler.new(path: @path, identifier: @identifier).call
    rescue Sass::CompileError => e
      raise "scss[#{@path}] #{e.message}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
view_component_scoped_css-0.2.0 lib/view_component_scoped_css/loader.rb
view_component_scoped_css-0.1.2 lib/view_component_scoped_css/loader.rb
view_component_scoped_css-0.1.1 lib/view_component_scoped_css/loader.rb
view_component_scoped_css-0.1.0 lib/view_component_scoped_css/loader.rb