Question: Generate SVG sprite without JS import
See original GitHub issueIs there a way to generate the sprite without importing each icon in my JavaScript file?
This is my webpack config and it does not work unless I use import icon from './path/to/icon'
although I set include
.
module: {
rules: [
{
test: /\.svg$/,
loader: 'svg-sprite-loader',
include: path.resolve(__dirname, 'source/assets/images/icons'),
options: {
extract: true,
spriteFilename: 'assets/images/icons.svg',
},
},
],
},
plugins: [
new SpriteLoaderPlugin(),
],
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
SVG sprite in external file - Stack Overflow
Try this: Create an SVG file, sprites.svg. Place the following in it: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" ...
Read more >Icon System with SVG Sprites - CSS-Tricks
Combine the .svg files · Inject that SVG at the top of the document · Use the icons wherever · Yay: you can...
Read more >Support SVG's in JS - Malibu - Quintype for Developers
In this chapter, we are going to discuss how to use SVGs in JS without ... Thus we are using SVG sprite loader...
Read more >Bootstrap Icons · Official open source SVG icon library for ...
Include them anyway you like—SVGs, SVG sprite, or web fonts. Use them with or without Bootstrap in any project. npm i bootstrap-icons.
Read more >svg-sprite - npm
svg -sprite is a low-level Node.js module that takes a bunch of SVG files, optimizes them and bakes them into SVG sprites of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can create entrypoint dynamically:
You can use require.context webpack feature. Somewhere in entrypoint of your application: