Giter Site home page Giter Site logo

Failed svg to ts conversion about svg-to-ts HOT 4 CLOSED

kreuzerk avatar kreuzerk commented on September 24, 2024
Failed svg to ts conversion

from svg-to-ts.

Comments (4)

kreuzerk avatar kreuzerk commented on September 24, 2024

Hi @dsebastien thanks for the great description and the reproduction steps. I created a local project to reproduce your issue. For me everything worked fine with the default svgoConfig of svg-to-ts. The cleanupAttrs cleans removes the color from your svg icon.

I used the following config which worked:

"svg-to-ts": {
    "srcFiles": [
      "./libs/web-icons/icons/**/*.svg"
    ],
    "outputDirectory": "./libs/web-icons/src/lib",
    "interfaceName": "DidowiIcon",
    "typeName": "DidowiIconName",
    "prefix": "didowiIcon",
    "optimizeForLazyLoading": true,
    "modelFileName": "didowi-icon.model",
    "additionalModelFile": "./libs/web-icons/src/lib",
    "iconsFolderName": "generated",
    "delimiter": "SNAKE",
    "compileSources": false
  },

When I copied the data from the generated svg and opened it in a browser I got like three pink stripes under each other.

from svg-to-ts.

kreuzerk avatar kreuzerk commented on September 24, 2024

Please let me know if this works for you.

from svg-to-ts.

dsebastien avatar dsebastien commented on September 24, 2024

Hello @kreuzerk

Indeed, you're right! I've verified and indeed, the SVG data is correct, our issue must be elsewhere; might be a CSS issue after all.

I wrongly assumed there was a conversion issue because I didn't find the elements of the SVG, but I suppose it is due to the compression that is done during conversion.

Sorry for the waste of time, and thanks for looking into this (and for creating this super useful tool! :p)

from svg-to-ts.

dsebastien avatar dsebastien commented on September 24, 2024

It seems that my issue is caused by the fact that the icons I'm now converting have a fill color (white in the example above), while the ones I was using earlier from Angular material had fill="none":

I could work around it using svgo plugins, but I still have an issue with the shape itself. Apparently the icon above's rectangle goes out of the bounds of the svg visible space.

By default I set the svg element to be 24x24px, but the rectangle is bigger than that.

Oh my this is complicated.... :D

from svg-to-ts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.