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

new command to combine all the svgs into a single svg file #35

Closed
un33k opened this issue May 18, 2018 · 7 comments
Closed

new command to combine all the svgs into a single svg file #35

un33k opened this issue May 18, 2018 · 7 comments

Comments

@un33k
Copy link

un33k commented May 18, 2018

Angular menu loads each icon individually and if service worker is not enabled, that is one call per country to the backend. It is so slow.

I am wondering if it is possible to do something like mdi, where they allow a single svg file for all the icons.

This way, there would be a single call to the backend to fetch all the flags.

Something like:

npm install -g svgexport imagemin-cli
npm run build-pngs -- 200 --combined=true:
@hampusborgos
Copy link
Owner

It is probably possible yes, you're thinking that each flag will be identified by an ID tag in a single SVG then?

@un33k
Copy link
Author

un33k commented Jun 10, 2018

@hjnilsson that is correct.

// usage: if we had a single flags.svg
<mat-icon svgIcon="ca"></mat-icon>
<mat-icon svgIcon="us"></mat-icon>

Here you see how Angular material is used to register multiple flags svg(s) vs. a single icon svg (mdi.svg).

Sadly, one trip to the backend is required for each svg.

@wyattoday
Copy link
Collaborator

There are lots of tools that take separate images and combines them to create a single sprite. Rather than re-create that work here, just use google to find one of the tools.

Here's one example: https://github.com/svg-sprite/svg-sprite

@wyattoday
Copy link
Collaborator

OK, there are tools to handle this. I linked to one. Google for others.

@OzBob
Copy link

OzBob commented Nov 20, 2023

duplicate of #13

@OzBob
Copy link

OzBob commented Nov 20, 2023

partially completed in this PR - Anyone want to fix it? #122

Fork: https://github.com/Ryszard-Trojnacki/country-flags/

@wyattoday
Copy link
Collaborator

@OzBob

The code was broken (on Windows at the very least). Also, there's limited applicability for this code.

Rather than creating specialized scripts that will likely break (I'm not going to maintain it), just use generalized open source projects that already accomplish what you're looking for (see above)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants