nivekcode / svg-to-ts

Build performant SVG icon libraries by converting raw SVG files to TypeScript that is optimized for modern tree shaking mechanisms.
MIT License
275 stars 45 forks source link

[Feature request] Angular builder #43

Closed kremerd closed 4 years ago

kremerd commented 4 years ago

It would be pretty nice to have an Angular builder to run svg-to-ts. The configuration could then be inlined in angular.json like so:

{
  "architect": {
    "update-icons": {
      "builder": "svg-to-ts",
      "options": {
        "conversionType": "constants",
        "srcFiles": ["./projects/dinosaur-icons/icons/**/*.svg"],
        "outputDirectory": "./projects/dinosaur-icons/icons",
        "interfaceName": "DinosaurIcon",
        "typeName": "dinosaurIcon",
        "prefix": "dinosaurIcon",
        "modelFileName": "dinosaur-icon.model",
        "svgoConfig": {
          "plugins": [
            {
              "cleanupAttrs": true
            }
          ]
        },
        "additionalModelFile": "./projects/dinosaur-icons/src/lib",
        "compileSources": true
      }
    }
  }
}

And the builder could be run via the Angular CLI:

ng run update-icons

Maybe it's even possible to get IntelliSense for the configuration in supported editors. Either way, integrating with the Angular build infrastructure seems desirable to me. What do you think?

kaltepeter commented 4 years ago

I am interested in picking up this issue.

nivekcode commented 4 years ago

Hi @kaltepeter - amazing. 👍 Contributors are always very welcome.

I think we should implement this feature in a dedicated repository since svg-to-ts is actually framework agnostic. So I imagine the Angular builder to be a wrapper around svg-to-ts. I still need to figure out the correct place for the repository. I personally would prefer to add it to a GitHub organization like ngneat or AngularExtensions. Having it on a organization has several benefits over having it in a private repo - more maintainers that can publish the package and better visibility.

Let me quickly talk to some organization members if it would be a fit for them. Once I know where we can put the repo I would love to come back to you so that we can start implementing things. How does that sound to you?

kaltepeter commented 4 years ago

@kreuzerk sounds good! I was wondering about that myself too, since it adds at the very least the @angular-devkit/architect and possibly @angular-devkit/architect to the dependencies and angular specific configs.

nivekcode commented 4 years ago

@kaltepeter I created an svg-icons-builder repository on the angular-extensions organization and added you as maintainer. https://github.com/angular-extensions/svg-icons-builder.

I am going to close this issue here - since it doesn't have a direct impact on svg-to-ts. Let's chat on Twitter for further details ;)