All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
4.3.2 (2019-07-15)
4.3.1 (2019-07-01)
- titleProp: handle the existing title case by using element instead of value (children) (#315) (065e7a9)
4.3.0 (2019-05-28)
- cli: output relative destination paths (#312) (b78e471)
- titleProps fallbacks to svg's title (#311) (8f92366)
4.2.0 (2019-04-11)
- keep viewBox when dimensions are removed (#281) (f476c8e)
- babel-preset: expandProps + icon option (ddfae22), closes #277
- cli: fix kebab case transformation with "_" (39c24c5), closes #280
- hast-util-to-babel-ast: correctly handle aria attributes (23d12aa), closes #279
- plugin-prettier: fix prettier warning (d01d33f)
4.1.0 (2018-11-24)
4.0.4 (2018-11-24)
4.0.3 (2018-11-13)
4.0.2 (2018-11-08)
4.0.1 (2018-11-08)
- babel-plugin-transform-svg: support template that only return a single node (80ac40f), closes #223
- babel-plugin-transform-svg-component: parsing error of JSX template exports defs (#225) (1e56309), closes /github.com/smooth-code/svgr/blob/master/packages/babel-plugin-transform-svg-component/src/util.js#L61
- hast-util-to-babel-ast: correctly transforms data & aria attributes (99711c4), closes #221
- hast-util-to-babel-ast: replace line-breaks in attributes (00a2625), closes #219
4.0.0 (2018-11-04)
- prevent babel read babel.config.js (#206) (514d43d)
- cli: fix --out-dir usage with absolute path (#208) (c922e2e)
- svgo: prefix ids by default (06c338d), closes #210
- v4: new architecture (ac8b8ca)
- allow dynamic properties in replaceAttrValues option (15f55fe), closes #205
- v4: -
template
option must now returns a Babel AST
@svgr/core
does not include svgo & prettier by default
3.1.0 (2018-10-05)
3.0.0 (2018-10-01)
- 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)
- config: improve runtime config (e52cdce), closes #192
- template: expose
getProps
util for template (5cb238e), closes #187 - add synchronous API (169eb2f), closes #185
- always prefix component name with "Svg" (f71aa7a), closes #190
- do not remove style tag (a4ce09a), closes #191
- new "expandProps" option (bb95828), closes #170
- remove "svgAttributes" option (4e46a5d), closes #173
- use forwardRef on React Native (4bdd989), closes #184
- use React.forwardRef (cbee51c), closes #184
- "--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 usesvgProps
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
16.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
2.4.1 (2018-09-16)
2.4.0 (2018-09-16)
- use literal instead of litteral (7849fd4)
- allow to spread props at the start (#166) (cd659dc)
- upgrade: h2x@1.1.0 (jsdom@12.0.0) & others (2d9b7bd)
- new option "svgProps" (#172) (9657110)
2.3.0 (2018-09-03)
- upgrade to Babel v7 (7bc908d)
2.2.1 (2018-08-16)
2.2.0 (2018-08-13)
- remove null-byte characters (#154) (de7f8a7), closes #153
- webpack: use source when possible (#139) (ae9965d)
2.1.1 (2018-07-11)
2.1.0 (2018-07-08)
- add .editorconfig support (#129) (968fd82)
- cli: support custom filename cases (#136) (4922f7a), closes #118
2.0.0 (2018-06-12)
SVGR now supports Prettier (.prettierc
) and SVGO (.svgo.yml
) configurations. It also supports a new .svgrrc
configuration. See the readme for more detail.
Rollup has now an official SVGR plugin available under @svgr/rollup
.
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
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>
Node v6 support has been dropped, you need Node >= 8 to run SVGR.
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
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
replace-attr-value
has been renamed intoreplace-attr-values
In API, replaceAttrValues
is now an object instead of an array.
rawConvert
method has been dropped- Templates now receive three arguments:
code
,config
andstate
componentName
must now be passed in state
Thanks to @MarquesDev and @lifeiscontent.
1.10.0 (2018-05-28)
1.9.2 (2018-05-14)
- ids: do not minify them (538b73f)
1.9.1 (2018-03-25)
- fix width / height override (1f91705), closes #issuecomment-375467614
- handle filename with numbers (a2387ea), closes #62 #64
1.9.0 (2018-03-08)
1.8.1 (2018-01-31)
1.8.0 (2018-01-31)
- support custom file extension (#47) (56a111f), closes #31
- webpack: include Babel transformation (#48) (dfecd39), closes #45
1.7.0 (2018-01-23)
- emSize: add support for missing width/height (2eacfd8)
- add option keepUselessDefs (3d03510), closes #36
- refactor emSize to reduce iterations (3c9d8b4)
1.6.0 (2018-01-08)
- support url-loader & file-loader (b95ed07)
1.5.0 (2017-12-12)
1.4.0 (2017-12-07)
- add "-native" option to target React Native (76fd6f5)
- native: import only relevant components (fcd4229)
- native: log unsupported components (888d968)
1.3.0 (2017-12-05)
- add option to keeps IDs from SVG (bfd4066)
1.2.0 (2017-12-04)
- simplify webpack usage (7ac643e)
1.1.0 (2017-11-24)
- add viewBox option that default to true (ba2be3a)
1.0.0 (2017-11-07)
- upgrade svgo & prettier (fd66885)
- SVGO now removes viewBox automatically.