svgr

Transform SVGs into React components 🦁

MIT License

Downloads
466M
Stars
10.3K
Committers
130

Bot releases are visible (Hide)

svgr - v3.0.0

Published by gregberge about 6 years ago

Bug Fixes

  • rollup: forward filePath in rollup plugin (461492b), closes #177 #188
  • webpack: forward filePath in webpack loader (b7a108e), closes #177 #188
  • fix --icon + --no-dimensions (7535693), closes #141
  • fix expandProps when position is not allowed (45522fc)

Features

BREAKING CHANGES

  • "--no-expand-props" is now replaced by "--expand-props none". You can now specify a position "start" or "end" for "expandProps"
    property.
  • svgAttributes has been removed, please use svgProps instead.
  • "ref" option now uses React.forwardRef. You don't have to use "svgRef"
    prop, just use "ref" and it will work. React.forwardRef requires React v16.3+.
  • Style tag will no longer be automatically removed. SVGO should handle it
    correctly using "inlineStyles" plugin. If you want to remove them,
    enable "removeStyleElement" plugin in your SVGO config.
  • rollup: runtime configuration is now loaded using rollup plugin.
  • webpack: runtime configuration is now loaded using webpack
    loader.
  • config: - Runtime configuration is always loaded (even with Node API convert)
  • In CLI, "--config" is now "--config-file"; this new option can be used
    everywhere
svgr - v2.4.1

Published by gregberge about 6 years ago

Bug Fixes

  • config: fix custom config & default options (#176) (9a6c40b)
svgr - v2.4.0

Published by gregberge about 6 years ago

Bug Fixes

  • use literal instead of litteral (7849fd4)

Features

svgr - v2.3.0

Published by gregberge about 6 years ago

Features

svgr - v2.2.1

Published by gregberge about 6 years ago

Bug Fixes

  • rollup: fix to work with rollup-plugin-typescript2 (#147) (4b3737e)
svgr - v2.2.0

Published by gregberge about 6 years ago

Bug Fixes

Features

svgr - v2.1.1

Published by gregberge over 6 years ago

Bug Fixes

  • core: config conflict with icon option (#137) (e13a99a)
svgr - v2.1.0

Published by gregberge over 6 years ago

Features

svgr -

Published by gregberge over 6 years ago

Features

Project configurations

SVGR now supports Prettier (.prettierc) and SVGO (.svgo.yml) configurations. It also supports a new .svgrrc configuration. See the readme for more detail.

Rollup plugin

Rollup has now an official SVGR plugin available under @svgr/rollup.

Split into several modules

SVGR is now an ecosystem of four modules:

  • @svgr/core: Core of SVGR, it exposes the Node API
  • @svgr/cli: Command Line Interface
  • @svgr/webpack: webpack loader
  • @svgr/rollup: a fresh new Rollup plugin

svgAttributes and titleProp options

Two new options appears, the first one svgAttributes gives you the opportunity to add attribute on the root svg tag without creating a custom template:

Command:

svgr --svg-attributes focusable=true foo.svg

Output:

props => <svg focusable="false" />

The second one, titleProp, adds a custom property title to specify the title of the SVG.

Command:

svgr --title-prop foo.svg

Output:

({ title }) => <svg><title>{title}</title></svg>

Breaking changes

Node version

Node v6 support has been dropped, you need Node >= 8 to run SVGR.

Prettier options

All Prettier options have been removed:

  • jsx-bracket-same-line
  • no-bracket-spacing
  • no-semi
  • single-quote
  • tab-width
  • trailing-comma
  • use-tabs

If you used it, use a .prettierrc instead of use the new option --prettier-config:

v1.x:

svgr --no-semi file.svg

v2.x:

svgr --prettier-config '{"semi": true}' file.svg

SVGO options

All SVGO options have been removed:

  • ids
  • keep-useless-defs
  • no-title
  • no-view-box
  • precision

If you used it, use a .svgo.yml instead of use the new option --svgo-config:

v1.x:

svgr --ids file.svg

v2.x:

svgr --svgo-config '{"plugins": [{"cleanupIDs": {"remove": false, "minify": false}}]}' file.svg

Other options

  • replace-attr-value has been renamed into replace-attr-values

In API, replaceAttrValues is now an object instead of an array.

Node API changes

  • rawConvert method has been dropped
  • Templates now receive three arguments: code, config and state
  • componentName must now be passed in state

Thanks

Thanks to @MarquesDev and @lifeiscontent.

svgr - v1.10.0

Published by gregberge over 6 years ago

Features

svgr - v1.9.2

Published by gregberge over 6 years ago

Bug Fixes

  • ids: do not minify them (538b73f)
svgr - v1.9.1

Published by gregberge over 6 years ago

Bug Fixes

svgr - v1.9.0

Published by gregberge over 6 years ago

Features

svgr - v1.8.1

Published by gregberge over 6 years ago

Bug Fixes

  • loader: add missing babel-plugin (#50) (c49b627)
svgr - v1.8.0

Published by gregberge over 6 years ago

Bug Fixes

Features

svgr - v1.7.0

Published by gregberge over 6 years ago

Features

  • emSize: add support for missing width/height (2eacfd8)
  • add option keepUselessDefs (3d03510), closes #36

Performance Improvements

  • refactor emSize to reduce iterations (3c9d8b4)
svgr - v1.6.0

Published by gregberge almost 7 years ago

Features

  • support url-loader & file-loader (b95ed07)
svgr - v1.5.0

Published by gregberge almost 7 years ago

Features

svgr - v1.4.0

Published by gregberge almost 7 years ago

Features

  • add "-native" option to target React Native (76fd6f5)
  • native: import only relevant components (fcd4229)
  • native: log unsupported components (888d968)
svgr - v1.2.0

Published by gregberge almost 7 years ago

Features

Package Rankings
Top 0.52% on Npmjs.org
Top 3.82% on Proxy.golang.org
Badges
Extracted from project README
License Donate npm package npm downloads CI Code Coverage
Related Projects