kc0bfv / autophugo

AutoPhugo [ˌɔtoʊˈfjuːgəʊ] is a gallery/photoblog theme for Hugo that's a little more automatic than Phugo.
Other
97 stars 56 forks source link

Support site custom css file #40

Closed Gordonby closed 2 years ago

Gordonby commented 2 years ago

Wanting to add support for a custom css file for the site that does not live in the theme folder. This will allow for easier customisation without affecting the ability to pull new versions from this project.

kc0bfv commented 2 years ago

Gordonby - thanks for the submission! I liked this idea and mistakenly thought it was already in there :-) I did it a little differently in the end though - the existing code has a CSS combination, minimization, and integrity step. I lumped the custom user.css in there with that. I added a default user.css in the theme "assets/css/user.css" file, and it's only a comment, so it gets eliminated by default. But - hugo's path searching rules mean that if you create a "css" directory in your site's "assets" directory (so, right alongside the images you're dropping in for your site), then put in a "user.css" file in there, Hugo will use your user.css instead of the theme's.

It's not the same as the "include multiple arbitrarily named CSS files specified in config" version that your code was using, but I think it gets to almost the same solution and keeps the result a little tighter.