Skip to content

Webpacker: Dynamic admin stylesheet definition #8153

@ahukkanen

Description

@ahukkanen

Describe the bug
Up until 0.24, components could define dynamic admin stylesheets to be included in the admin stylesheet as shown here:

<% Decidim.component_manifests.map(&:admin_stylesheet).compact.each do |stylesheet| %>
@import "<%= stylesheet %>";
<% end %>

After the webpacker migration, I this is no longer possible.

To Reproduce

  1. Define an admin stylesheet for a component using component.admin_stylesheet = "...".
  2. See if the stylesheet got included in the admin styles

Expected behavior
We should apply a similar fix for the admin stylesheet inclusions as we did for the dynamic front-end stylesheet inclusions at:
#8115

I suggest the following register method for the admin stylesheets:

Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foobar/admin", group: :admin)

Screenshots
N/A

Stacktrace
N/A

Extra data (please complete the following information):

  • Device: (any)
  • Device OS: (any)
  • Browser: (any)
  • Decidim Version: 0.25.0+
  • Decidim installation: (any)

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions