Page 1 of 1

Images added through css missing from output folder

Posted: Tue Aug 03, 2021 7:49 pm
by ldube
Is there an way to force include some images?
Basically, we are modifying how the note, tip and warnings looks like through css, but the images are not added to the output folder because the images are not referenced in the actually xml sources.

This is how I modify the image.

Code: Select all

div.note > span.note__title {
    background-repeat: no-repeat;
    background-image: url(images/note.png) !important;
    font-weight: bold;
}

Re: Images added through css missing from output folder

Posted: Wed Aug 04, 2021 3:30 pm
by ionela
Hi,

To copy the images in the output, please check this topic from our user manual: How to Copy Additional Resources to Output Directory

Regards,
Ionela

Re: Images added through css missing from output folder

Posted: Thu Aug 05, 2021 12:11 am
by ldube
Hi, thanks for the reply.

I'm using DITA to HTML5 as well as DITA to CHM.
The option you mentioned doesn't seem available in those two transformations.

Re: Images added through css missing from output folder

Posted: Thu Aug 05, 2021 9:18 am
by Radu
Hi,

The DITA Open Toolkit does not have a certain parameter for including certain content no matter for what publishing format.

But what I would sometimes do in such cases is to refer in the DITA Map to those images as resource-only content like:

Code: Select all

<topicref href="someImage.png" format="png" processing-role="resource-only"/>
They do not appear in the table of contents but get copied to the output folder. And this works for any type of resource that you want copied to the output folder.

Regards,
Radu

Re: Images added through css missing from output folder

Posted: Thu Aug 05, 2021 4:56 pm
by ldube
Thank you.
This works well for the HTML5 format.
Sadly the images are not copied for the CHM format.

Re: Images added through css missing from output folder

Posted: Fri Aug 06, 2021 8:36 am
by Radu
Hi,

If you set the transformation parameter "clean.temp" to "no" and publish to CHM, you can afterwards look in the transformation temporary folder temp\chm\temp_chm_dir, the image should be there, but when the HTML Help Workshop constructs the CHM, it starts from the hhp, hhk and hhc files which do not refer to the image, so the compiled CHM no longer has it as none of the HTML documents inside it refers directly to the image.
Maybe one option would be to place the image base 64 encoded in the CSS. I'm not sure if "background-image" works at all in a CHM because it uses a web browser with a more limited set of features.

Regards,
Radu

Re: Images added through css missing from output folder

Posted: Wed Aug 18, 2021 6:43 pm
by ldube
Thank you!
The base64 background-image worked both in html output and chm output