Class: ViewComponentScopedCss::Loader
- Inherits:
-
Object
- Object
- ViewComponentScopedCss::Loader
- Defined in:
- lib/view_component_scoped_css/loader.rb
Overview
Resolve css module naming after loading and compiling scss files to provide final css
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(view_component_class) ⇒ Loader
constructor
class_attribute :compile_options, default: { source_map: true, style: { output: :compressed } }.
Constructor Details
#initialize(view_component_class) ⇒ Loader
class_attribute :compile_options, default: { source_map: true, style: { output: :compressed } }
10 11 12 13 |
# File 'lib/view_component_scoped_css/loader.rb', line 10 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 |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 |
# File 'lib/view_component_scoped_css/loader.rb', line 15 def call ViewComponentScopedCss::Compiler.new(path: @path, identifier: @identifier).call rescue Sass::CompileError => e raise "scss[#{@path}] #{e.}" end |