Class: ViewComponent::ScopedStyles::Configuration
- Inherits:
-
Object
- Object
- ViewComponent::ScopedStyles::Configuration
- Defined in:
- lib/view_component/scoped_styles/configuration.rb
Overview
Global settings for ViewComponent::ScopedStyles.
Configure in an initializer:
ViewComponent::ScopedStyles.configure do |config|
config.components_path = File.join("app", "view_components")
config.components_layer = "components"
end
Instance Attribute Summary collapse
-
#components_layer ⇒ String?
Optional CSS cascade layer name for generated styles in
app/assets/stylesheets/components.scoped.css. -
#components_path ⇒ String
Directory where ViewComponent classes live, relative to Rails.root.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
28 29 30 31 |
# File 'lib/view_component/scoped_styles/configuration.rb', line 28 def initialize @components_path = File.join("app", "components") @components_layer = nil end |
Instance Attribute Details
#components_layer ⇒ String?
Optional CSS cascade layer name for generated styles in app/assets/stylesheets/components.scoped.css.
When set, the bundled stylesheet is wrapped in @layer <name> { … } so you can control specificity relative to other layers in your app.
26 27 28 |
# File 'lib/view_component/scoped_styles/configuration.rb', line 26 def components_layer @components_layer end |
#components_path ⇒ String
Directory where ViewComponent classes live, relative to Rails.root.
17 18 19 |
# File 'lib/view_component/scoped_styles/configuration.rb', line 17 def components_path @components_path end |