svg-to-ts icon indicating copy to clipboard operation
svg-to-ts copied to clipboard

Customize output filename

Open treksn opened this issue 2 years ago • 2 comments

We are using svg-to-ts in our project to inline SVGs which works really nice. However these SVGs are not really "icons" and I wonder if it would be possible to customize the filename of the generated output files from your library. Currently it is like this: file-name.icon.ts . Would it be possible to customize this withing the config for example file-name.svg.ts ? That would be nice.

Thank you!

treksn avatar Apr 08 '22 11:04 treksn

Hi @treksn thx a lot for this issue. Yes, that's definitely possible. I can take a look at this once I find the time. Unfortunately, I can currently not think of a descriptive name for this option. Naming, the hardest thing in programming. Good ideas for on how to name this options are more then welcome ;)

kreuzerk avatar Apr 09 '22 20:04 kreuzerk

Hi everyone,

We have a similar need, maybe a bit more complex.

In our case our svg lib outputs the following for each icon: image It is exported that way because of mobile apps. On the web we intent to use only the 24 size, so we want to drop the _24 and the _filled parts of the name and change the regular to _outline. For now we have another script between the svg lib output and the svg-to-ts that copy and transform all file names to a second directory.

ex:

add_subtract_circle_24_regular.svg -> add_subtract_circle_outline.icon.ts
add_subtract_circle_24_filled.svg  -> add_subtract_circle.icon.ts

Name suggestion: filename-replacer: [ { '_24': '' }, { '_regular': '_outline' }, { '_filled': '' }, ]

rubens-lopes avatar Oct 24 '22 19:10 rubens-lopes