Assets and Theme Components

I might be missing something, but I’m trying to wrap my head around how assets from a Theme Component would be included in an existing site.

Say a user has an site with content using the BaseTheme theme. It’s beautiful, but they want to add a theme component to it, FancyComponent. The add-on component could provide either a shortcode that generates for the main content area, or maybe it defines a whole new type with a different default layout.

In either of those cases, I’m thinking about the process for the user to integrate the component into their existing site:

  1. Install Component (either Go Modules or git submodule, don’t think that impacts this). It will be installed in themes/FancyComponent
  2. Modify their config file to add the new theme in to the theme array.

That’s fairly straight forward, and makes sense.

But FancyComponent includes a CSS file for styling itself, which is in themes/FancyComponent/asserts/or themes/FancyComponent/static/ directories.

How can a theme insert the needed assets into the existing head.html partial (assuming that the existing theme is setup in a standard way? Or since there isn’t too much of a standard, is every install going to require manual work for the user to figure out where to make modifications, which will probably be different for every install?

Unless I’m missing something, seems like prevents any truly “drop in” components.

And on a somewhat related note, assuming a base template does use define blocks so that they can be easily overriden, is there anyway to override, but still call the overridden block so you could add to the base without repeating?

1 Like