Inkscape.org
Beyond the Basics Say Inkscape to embade an External CSS File when exporting as SVG
  1. #1
    wieserfalke wieserfalke @wieserfalke

    Hi,

    I wanted to ask if it is possible to say Inkscape that it should embed an external CSS file in to the SVG if I say export as SVG.

    For Testing, I have "pic.svg"

    <svg width="300" height="200" class="star">
        <style>
            @import url(style.css);
        </style>
        <polygon points="100,10 40,198 190,78 10,78 160,198" />
    </svg>
    

     

    and "style.css"

    .star {
    	fill: lime;
    	stroke: rgba(47, 0, 128, 0.93);
    	stroke-width: 5;
    	fill-rule: evenodd;
    }
    

    (based on https://www.geeksforgeeks.org/how-to-change-styles-of-svg-image-using-css/)

     

    but When I say export plain SVG this is the resault:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <svg
       width="300"
       height="200"
       class="star"
       version="1.1"
       id="svg1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:svg="http://www.w3.org/2000/svg">
      <defs
         id="defs1" />
      <style
         id="style1">
            @import url(style.css);
        </style>
      <polygon
         points="190,78 10,78 160,198 100,10 40,198 "
         id="polygon1" />
    </svg>
    

    It once again uses "@import url(style.css);" and not the actual CSS contant.

    If posible I actualy would also like to know how to enable it on the Comand line.

  2. #2
    Maren Hachmann Maren Hachmann @Moini

    Don't think there is functionality for that. How about you copy that in with a text editor or awk?

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Say Inkscape to embade an External CSS File when exporting as SVG