Skip to content

Commit

Permalink
feat: do not remove style tag
Browse files Browse the repository at this point in the history
Removing style tag is an optimization, SVGO can do it better than us.

BREAKING CHANGE:

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.

Closes #191
  • Loading branch information
gregberge committed Sep 30, 2018
1 parent f71aa7a commit a4ce09a
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 53 deletions.
1 change: 1 addition & 0 deletions packages/core/src/__snapshots__/convert.test.js.snap
Expand Up @@ -428,6 +428,7 @@ const SvgComponent = props => (
<path d=\\"M51 37L37 51\\" id=\\"Shape\\" />
<path d=\\"M51 51L37 37\\" />
</g>
<style />
</g>
</svg>
)
Expand Down
10 changes: 0 additions & 10 deletions packages/core/src/h2x/__snapshots__/removeStyle.test.js.snap

This file was deleted.

13 changes: 0 additions & 13 deletions packages/core/src/h2x/removeStyle.js

This file was deleted.

22 changes: 0 additions & 22 deletions packages/core/src/h2x/removeStyle.test.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/src/index.js
Expand Up @@ -8,7 +8,6 @@ export { default as emSize } from './h2x/emSize'
export { default as expandProps } from './h2x/expandProps'
export { default as removeComments } from './h2x/removeComments'
export { default as removeDimensions } from './h2x/removeDimensions'
export { default as removeStyle } from './h2x/removeStyle'
export { default as replaceAttrValues } from './h2x/replaceAttrValues'
export { default as stripAttribute } from './h2x/stripAttribute'
export { default as svgAttributes } from './h2x/svgAttributes'
Expand Down
8 changes: 1 addition & 7 deletions packages/core/src/plugins/h2x.js
Expand Up @@ -5,7 +5,6 @@ import {
expandProps,
removeComments,
removeDimensions,
removeStyle,
replaceAttrValues,
stripAttribute,
svgAttributes,
Expand All @@ -16,12 +15,7 @@ import {
} from '..'

function configToPlugins(config) {
const plugins = [
jsx,
stripAttribute('xmlns'),
removeComments(),
removeStyle(),
]
const plugins = [jsx, stripAttribute('xmlns'), removeComments()]
if (config.replaceAttrValues)
plugins.push(replaceAttrValues(config.replaceAttrValues))
if (!config.dimensions) plugins.push(removeDimensions())
Expand Down

0 comments on commit a4ce09a

Please sign in to comment.