How to add CSS from a Theme Component?

the CSS required by the Component is now hardcoded in the partial file, is there a more elegant way to inject custom CSS from a child theme?

Here’s one way, using Hugo Module Mounts to the assets/ directory and then using the Resources related functions.

Here’s the part that does the injection of CSS based on a site parameter.

Demo site


Reference

3 Likes