question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi all! I am preparing to release big update, it’s already accessible as svg-sprite-loader@2.0.0-alpha.4.

Please read carefully about upcoming breaking changes, new features and bugfixes.

Breaking changes

Node.js >= 6 required

¯_(ツ)_/¯

If you think that Node.js < 6 should be supported, please vote up in this issue.

Targeting Webpack 2

¯_(ツ)_/¯

If you think that Webpack 1 should be supported, please vote up in this issue.

Loader should always be configured with plugin, otherwise error is thrown.

Reason: architectural changes. Migration: just add a plugin in your webpack config

// webpack.config.js
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');

...

{
  plugins: [
    new SpriteLoaderPlugin()
  ]
}

name config option renamed to symbolId

Reason: more obviously.

regExp config option was removed

Reason: symbolId should cover most of naming cases.

prefixize config option was removed

Reason: all symbol elements isolated by default.

angularBaseWorkaround config option was removed

Reason: Angular introduced ability to remove the base tag requirement, see correspondent issue comment. If you still need it check angular-svg-base-fix.

Runtime has changed

Instead of symbol id runtime module now returns an object (class instance actually) which contains id, viewBox and content fields. See SpriteSymbol class and runtime generator.

Reason: make runtime more flexible, also it was requested in #32. Migration:

// old
import symbol from './image.svg';
const rendered = `
<svg>
  <use xlink:href="${symbol}" />
</svg>`;


// new
import symbol from './image.svg';

// now .viewBox is available
const rendered = `
<svg viewBox="${symbol.viewBox}">
  <use xlink:href="#${symbol.id}" />
</svg>`;

If you think that loader should provide compatibility in this case, please vote up in this issue.

Features, improvements and bugfixes

Auto configuring

Some magic now happens by default, viz:

Sprite generator

  • Sprite/symbol generator was moved in separate project (svg-baker) and fully reworked. It’s incredible customizable now. Customization via plugin coming soon.

Client runtime

  • Sprite/symbol javascript runtime was moved in separate project (svg-baker-runtime) and fully reworked.
  • Added ability to specify custom runtime generator via runtimeGenerator option (check default runtime generator for example).
  • Runtime symbol is an object now (class instance actually). It contains id, viewBox and content fields. See SpriteSymbol class.
  • Base URL fix in style attributes (via svg-baker-runtime).
    • Fixes #7.

Server side rendering

  • Server side rendering done right! See example.
  • Fixes #19.

Extract sprite/sprites as separate file/files

  • Extract sprite as separate file done right! See example.
  • Ability to extract multiple separate sprites by webpack loader config (example will be soon).
  • Ability to extract sprite for each chunk, like extract-text-webpack-plugin (example will be soon). Experimental feature, should be used with caution.
  • Fixes #66, #73, #83.

TODO

  • More tests and examples.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kisenkacommented, Apr 28, 2017

🎉 2.0 is out, please read migration guide & overview.

1reaction
kisenkacommented, Apr 23, 2017

svg-sprite-loader@2.0.0-alpha.3 with domready is published 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

RUDIS Alpha 2.0 Adult Wrestling Shoes
SIZE CHART Stand out on the mat with the Alpha 2.0 Wrestling Shoe. Inspired by the designs of classic wrestling shoes, the Alpha...
Read more >
Rudis Men's Alpha 2.0 Wrestling Shoes
Upper built with overlapping synthetic suede offering a support system that molds to the foot; Air mesh body for breathability. Durability & Traction:...
Read more >
Pocket Edition v0.2.0 alpha - Minecraft Wiki - Fandom
v0.2.0 alpha was a major update to Minecraft: Pocket Edition. It added Survival mode as well as other changes and bug fixes. This...
Read more >
Rudis Alpha 2.0 "Crimson Ice" Men's Wrestling Shoe
The Rudis Alpha 2.0 "Crimson Ice" Men's Wrestling Shoe provides an omnidirectional outsole with forefoot and heel pods made of compression-molded rubber for ......
Read more >
Alpha 2.0 Turned Out SO Good, He HAD To Show Me In Person!
After working with Atlanta Custom Wraps on trying to figure out a wrap for the 600LT, we finally found what were looking for!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found