Comments (4)
Hi 👋
This feature is not available in the current version. However, I would appreciate your pr!
from vite-svg-sprite-wrapper.
I found the same question svg-sprite/svg-sprite#731
from vite-svg-sprite-wrapper.
Hi!
Thanks for the link to the discussion on svg-sprite 👍️
I think I will add an option to vite-svg-sprite-wrapper
to ouptut a typescript file types: {path: string; typeName: string}
. Something quite simple should work: type SymbolId = 'one' | 'two' | 'three';
Based on a quick look at svg-sprite
and vite-svg-sprite-wrapper
, I see three ways to do it (I'm not sure yet which ones are possible):
The ideal way
svg-sprite
gives access to the ID of the generated shapes through getShapes
. We can use it in vite-svg-sprite-wrapper
and generate that "type" file.
The risky way
In vite-svg-sprite-wrapper
we recreate the generateId function of svg-sprite
to "guess" the generated ID (using the config object when available). Then we hope they don't change their mind ever 😅️
The inefficient way
We parse the Symbol again to extract its ID.
I'll have a look on Monday and try to implement it in the ideal way 🤓️
Of course I'm open to do it another way if you think there's a better approach.
from vite-svg-sprite-wrapper.
A pull request was created: #8
from vite-svg-sprite-wrapper.
Related Issues (8)
- Doesn't appear to run on build? HOT 6
- `outputDir` to `dist/` HOT 8
- The sprite is not rebuilt in development mode HOT 3
- Sprite SVG option: "mode.symbol.sprite" causes infinite loop during vite build watch HOT 2
- Manifest support HOT 4
- Build task writeBundle will happen after the project has been built HOT 6
- SVGO support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-svg-sprite-wrapper.