How about having a (per-image) option for the compiler to insert an image's SVG file contents directly into the HTML during WebHelp publishing?
Option to inline SVG image
Moderators: Alexander Halser, Tim Green
-
- Posts: 206
- Joined: Thu Jul 13, 2017 2:57 pm
Option to inline SVG image
- Tim Green
- Site Admin
- Posts: 23186
- Joined: Mon Jun 24, 2002 9:11 am
- Location: Bruehl, Germany
- Contact:
Re: Option to inline SVG image
Hi Simon,
Interesting idea, but I think it's a bit more involved than just inlining the content. It only really works with very simple icon-style SVGs with a single path, and sometimes you need to remove the fill attribute and make other changes. Then there are SVG sprites, which are a completely different kettle of fish: There you need to combine multiple SVGs into a single block of code in the template, along with IDs, and insert them by referencing their IDs. Also considerably more than just pasting SVG code.How about having a (per-image) option for the compiler to insert an image's SVG file contents directly into the HTML during WebHelp publishing?
Regards,
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
-
- Posts: 206
- Joined: Thu Jul 13, 2017 2:57 pm
Re: Option to inline SVG image
Yes, it's not necessarily simple. Nevertheless, for SVG files that the author has created specifically for H&M, it might be helpful to have the option to incorporate them inline.Tim Green wrote:Hi Simon,Interesting idea, but I think it's a bit more involved than just inlining the content. It only really works with very simple icon-style SVGs with a single path, and sometimes you need to remove the fill attribute and make other changes. Then there are SVG sprites, which are a completely different kettle of fish: There you need to combine multiple SVGs into a single block of code in the template, along with IDs, and insert them by referencing their IDs. Also considerably more than just pasting SVG code.How about having a (per-image) option for the compiler to insert an image's SVG file contents directly into the HTML during WebHelp publishing?
I've been playing with using SVG-injector to load SVG content into H+M topics at run time. Works so long as there's no <script> in the SVG file, but it is difficult to get the CSS right because the injector code overrides the specificity of selectors. When I've got time I'll try to fork a version that doesn't have that limitation. But getting the compiler to do the inlining would be simpler.