With SVG graphics, i think it is a good pratice to externalize presentation attributes as CSS instructions (in a specific cell), since it makes the SVG code more concise and readable, and the styles reusable across different charts.
If i export my SVG cell as a standalone SVG file with , the styles will be missing and the graphic will render incorrectly.
So far, to fix this, i need to copy and paste the styles and add them to the SVG file in a <style> block. Or better, in a
block, so it will render properly in Illustrator for instance.
I wish i could, in Observable, benefit from a SVG export functionality allowing to inject those styles in the exported file, just selecting for instance the cell with the relevant styles.
Hi @radames,
and thank you for the hint!
It works indeed in Illustrator, actually, i had quite an old version (CS6), but with a more recent version (2020), styles are properly recognized on import.
Say i have multiple charts sharing same styles: which annoys me is the repetition within each svg of these common_styles. I wish i could embed them only on exporting a specific svg cell.
hi @emauviere , I see the problem, you could automated this process and use some zip hack to download all at once.
The only annoying step is to name each cell, you need the reference cell and the file name, afaik itβs not straightforward to get the cell name without using the runtime.