Skip to content

Releases: chrise86/view_component-scoped_styles

v0.6.1

Choose a tag to compare

@github-actions github-actions released this 11 Jun 20:11
29495c5

Fixed

  • Load the ViewComponent component generator hook only when Rails generators are loaded, preventing app boot failures.

v0.6.0

Choose a tag to compare

@github-actions github-actions released this 07 Jun 15:53
fa46c97

Added

  • config.view_component.generate.stylesheet = true to auto-generate a sidecar-compatible .css file when running view_component:component, inject include ViewComponent::ScopedStyles, and add component_class to the generated ERB template.
  • component_class(..., from: OtherComponent) to reference scoped classes from another component in templates.
  • :component(OtherComponent[, class_name]) compile-time CSS references for sidecar stylesheets and styles blocks, including use inside selector functions like :where() and :has().

Fixed

  • Require ActiveSupport's enumerable extensions explicitly so scoped class map generation has index_with available outside Rails load paths.

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 01 Jun 18:24

Breaking changes

This release is incompatible with 0.4.x. Scoped class names and compiled CSS selectors change unless you opt into the previous behaviour.

  • Default css_class_prefix is now "{class_name}_" instead of "c-". For example, .component becomes .component_a1b2c3d4 rather than .c-a1b2c3d4.
  • css_class_prefix is a template string supporting {class_name} and {component_name} (namespaces joined by /). Per-component css_class_prefix uses the same interpolation.
  • Forward slashes in interpolated class names are escaped in compiled CSS selectors (e.g. Admin/UserCardComponentAdmin\/UserCardComponent).

Upgrade from 0.4.x: set config.css_class_prefix = "c-" in your initializer (and per-component overrides if any) to keep existing class names, then regenerate components.scoped.css in development. Otherwise update templates and markup to match the new scoped class names.

Added

  • ViewComponent::ScopedStyles::CssClassPrefix for prefix interpolation and CSS selector escaping.

v0.4.1

Choose a tag to compare

@github-actions github-actions released this 01 Jun 11:18

Fixed

  • Railtie component discovery now respects the configured components_path instead of always scanning app/components.

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 31 May 09:44

Added

  • assets_path and stylesheet_name global configuration options to customize where the bundled scoped stylesheet is written (defaults: app/assets/stylesheets and components.scoped.css).

v0.3.0

Choose a tag to compare

@chrise86 chrise86 released this 29 May 13:19

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@chrise86 chrise86 released this 29 May 13:18

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@chrise86 chrise86 released this 29 May 13:18

Initial release