Material-ui: Publish @material-ui/icons-builder as a separate module

Created on 23 Oct 2018  路  4Comments  路  Source: mui-org/material-ui

  • [x] This is not a v0.x issue.
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior


I've been playing around with the icons-builder tool and would love to be able to integrate this into my build process as a dependency.

Current Behavior


Currently, I have to clone down the @material-ui repository, copy in my svg folder, run the script, and then copy the output folder back to my destination. Including @material-ui/icons as a dependency only provides the mui icons themselves, but not the script to build them.

Alternatively, I can move all of the relevant code into my repository, which works, but I'd rather have it as an external dependency to keep up with the latest improvements.

Examples


It would be nice to be able to use the tool in an npm script, e.g.,

"build:svgs" : "babel-node ./node_modules/@material-ui/icons-builder/builder.js --svg-dir ./src --output-dir ./build"

or as its own CLI, e.g.,

"build:svgs" : "mui-icon --svg-dir ./src --output-dir ./build"

or something similar.

Context


I am working on publishing a bunch of custom svg icons as an npm package and would like to be able to make them available to a react/material-ui application in the same way the material-ui/icons are used.

Any chance of the icons-builder tool being published to npm as a separate @material-ui package?

enhancement low priority

All 4 comments

@joebochill I have no objection to that. Do you want to work on it? Did you try https://github.com/smooth-code/svgr out before?

Currently, I have to clone down the @material-ui repository, copy in my svg folder, run the script, and then copy the output folder back to my destination.

You could add the relevant npm script to your local package.json file, referencing the js script from the material-ui icons directory. You would still need you to have a clone of material-ui, but would save copying files back and forth.

Alternatively you could maintain a local copy of the script and template in your SVG directory, and not depend on material-ui providing it.

Not saying packaging it up is a bad idea, but I don't see it adding much value.

Thanks for the suggestions. SVGR was pretty much exactly what I needed for my use case. For good measure, I also got it working by bundling up the necessary files into a subfolder in my package and running the builder.js script that way.

I agree with @mbrookes that this is probably not a widespread use case, but I'm happy to mess around with packaging it up and make a PR if anything comes of it.

Alright, let's encourage svgr :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chadobado picture chadobado  路  119Comments

damianobarbati picture damianobarbati  路  55Comments

HZooly picture HZooly  路  63Comments

kybarg picture kybarg  路  164Comments

iceafish picture iceafish  路  62Comments