Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with fill inside style tag #10

Open
javierartero opened this issue Nov 27, 2018 · 1 comment
Open

Problems with fill inside style tag #10

javierartero opened this issue Nov 27, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@javierartero
Copy link
Member

javierartero commented Nov 27, 2018

Describe the bug
when the color is in a style this is converted to an attribute but it is not replaced, I think it should be delayed to replace so that this does not happen

To Reproduce
use svgpack on an image with fill color inside style tag

Expected behavior
should replace the value of the fill in the function by the parameter $color

Screenshots

  • Original
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><defs><style>.cls-1{fill:#fff;}</style></defs>
  • svgpack
@function uae-icon($color: #FFF) {
  $color: str-replace(inspect($color), '#', '%23'); //fix and replace hexcolor
  @return url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' data-name='Layer 1' viewBox='0 0 300 300'%3E%3Cpath fill='%23fff' ..............;
}
@javierartero javierartero added the bug Something isn't working label Nov 27, 2018
@javierartero
Copy link
Member Author

This error occurs when exporting from XD or other programs that save hexadecimal colors in lowercase, as the property is capitalized, it does not replace the variable.

Example of exported file

<svg xmlns="http://www.w3.org/2000/svg" width="12.414" height="12.414" viewBox="0 0 12.414 12.414">
  <g id="Grupo_3998" data-name="Grupo 3998" transform="translate(-153.293 -508.793)">
    <line id="Línea_1349" data-name="Línea 1349" x2="11" y2="11" transform="translate(154 509.5)" fill="none" stroke="#0077c8" stroke-width="2"/>
    <line id="Línea_1350" data-name="Línea 1350" x1="11" y2="11" transform="translate(154 509.5)" fill="none" stroke="#0077c8" stroke-width="2"/>
  </g>
</svg>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant