orchidhq / Orchid

Build and deploy beautiful documentation sites that grow with you
https://orchid.run
GNU General Public License v3.0
513 stars 53 forks source link

Replace theme background image? #325

Closed swaldman closed 4 years ago

swaldman commented 4 years ago

I'm just trying to get my feet wet with Orchid, and an easy beginning I thought would be to replace the sidebarBackground (from Copper) in config.yml.

So, I add a new image to my own assets/media directory, and try something like

theme:
  sidebarBackground: 'media/myImage.png'

It doesn't work. Investigating a bit, I see the problem in the generated extraCss.css:

.hero-image {
  background-color: white !important;
  background-image: url("");
  background-position: 50% 50%;
  background-size: cover; }

Interestingly, if I change 'media/myImage.png' to any file natively included in the plugin ('media/bg-sidebar.jpeg', 'media/bg-texture.png', or 'media/theme-logo.png'), it works, an appropriate URL is substituted into the url construct and the background image appears. Although my images are unified with these issues in the destination, it feels like the scss processor is aware only of the in-theme media set and fails if something not from that set is specified. Is that right? Is there any way to work around this?

I don't see any kind of error message during the processing of the site. That could well be my issue: I'm running in my own plugin rather than gradle, and perhaps there's logging I've failed to integrate. I do see lots of [INFO] level logging, as well as console output with modules loaded, config information, and stats about the site. But I'm not sure if there's something I should do to see lower-than-[INFO] level logging. (My environment flag is debug, but that may not be enough.)

Anyway, thank you for any help! This looks like an exciting and valuable tool, but I'm a long way off from getting the hang of it...

cjbrooks12 commented 4 years ago

You should be referencing your images with the full path from the resources root, such as sidebarBackground: 'assets/media/myImage.png'. The images referenced from the theme should be not getting loaded without the assets/ prefix, I have no idea how that is even happening. Your SBT plugin is working just fine, I am reproducing the same issue when running from both Gradle and Maven.

swaldman commented 4 years ago

That was it! Thank you!