Images added through css missing from output folder

Questions about XML that are not covered by the other forums should go here.
ldube
Posts: 6
Joined: Tue Aug 03, 2021 7:46 pm

Images added through css missing from output folder

Post by ldube » Tue Aug 03, 2021 7:49 pm

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;
}

ionela
Posts: 358
Joined: Mon Dec 05, 2011 6:08 pm

Re: Images added through css missing from output folder

Post by ionela » Wed Aug 04, 2021 3:30 pm

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
Ionela Istodor
oXygen XML Editor and Author Support

ldube
Posts: 6
Joined: Tue Aug 03, 2021 7:46 pm

Re: Images added through css missing from output folder

Post by ldube » Thu Aug 05, 2021 12:11 am

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.

Radu
Posts: 7592
Joined: Fri Jul 09, 2004 5:18 pm

Re: Images added through css missing from output folder

Post by Radu » Thu Aug 05, 2021 9:18 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

ldube
Posts: 6
Joined: Tue Aug 03, 2021 7:46 pm

Re: Images added through css missing from output folder

Post by ldube » Thu Aug 05, 2021 4:56 pm

Thank you.
This works well for the HTML5 format.
Sadly the images are not copied for the CHM format.

Radu
Posts: 7592
Joined: Fri Jul 09, 2004 5:18 pm

Re: Images added through css missing from output folder

Post by Radu » Fri Aug 06, 2021 8:36 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

ldube
Posts: 6
Joined: Tue Aug 03, 2021 7:46 pm

Re: Images added through css missing from output folder

Post by ldube » Wed Aug 18, 2021 6:43 pm

Thank you!
The base64 background-image worked both in html output and chm output

Post Reply