svgr

Transform SVGs into React components 🦁

MIT License

Downloads
466M
Stars
10.3K
Committers
130

Bot releases are hidden (Show)

svgr - v8.1.0 Latest Release

Published by gregberge about 1 year ago

Bug Fixes

  • cli: fix default dimensions, prettier & svgo (571d5c8)
  • config: prefer cli config over rc config (#845) (8b97248)
  • react-native: fix duplicate import (#894) (e612b6a)

Features

  • esm: add support for svgo.config.cjs (#879) (ae91e2e)
svgr - v8.0.1

Published by gregberge over 1 year ago

Bug Fixes

svgr - v8.0.0

Published by gregberge over 1 year ago

Bug Fixes

  • parseObject error causes website broken (05f2946)

Features

  • types: change SVGProps from import to import type (#853) (095f021)
  • add snake_case filename option (#857) (428b0c7)
  • make index template more flexible (#861) (003009c)

BREAKING CHANGES

  • index template now receives an array of objects containing both the created
    component path (path) and the original SVG path (originalPath)
svgr - v7.0.0

Published by gregberge over 1 year ago

Features

BREAKING CHANGES

  • plugin-jsx is no longer included by default in core
  • svgr now requires Node.js v14+
svgr - v6.5.1

Published by gregberge almost 2 years ago

svgr - v6.5.0

Published by gregberge about 2 years ago

Bug Fixes

Features

  • babel-preset: fix 'role' attribute on svg element for react native (#787) (35d85e0)
svgr - v6.4.0

Published by gregberge about 2 years ago

Bug Fixes

  • deps: add babel-preset to core dependencies (#782) (464ec5f)

Features

  • a11y: add attribute role="img" to the svg element (#750) (8b9edc4)
  • support spaces in file names (#779) (6ee639a)
svgr - v6.3.1

Published by gregberge about 2 years ago

Bug Fixes

svgr - v6.3.0

Published by gregberge over 2 years ago

Bug Fixes

Features

  • add descProp option (#729) (a0637d4)
  • cli: output file name when error happen to handling a file (#702) (0ec1fbd)
svgr - v6.2.1

Published by gregberge over 2 years ago

Bug Fixes

svgr - v6.2.0

Published by gregberge almost 3 years ago

Bug Fixes

  • cli: pass in parser to prettier format to avoid deprecation warning (#662) (74fa3ae)
  • plugin-svgo: handle potential errors from optimize (#663) (7582d31)

Features

svgr - v6.1.2

Published by gregberge almost 3 years ago

Bug Fixes

  • specify valid peer deps (45a76ed)
  • rollup: missing dep & missing map return (#652) (12627fc)
svgr - v6.1.1

Published by gregberge almost 3 years ago

Bug Fixes

svgr - v6.1.0

Published by gregberge almost 3 years ago

Bug Fixes

Features

  • native: automatically convert inline style in native (138c493), closes #588

Performance Improvements

  • remove useless loader-utils package (387bc72), closes #631
svgr - v6.0.0

Published by gregberge almost 3 years ago

SVGR v6 uses SVGO v2 under the hood and includes tons of improvement. It also contains small breaking changes. In most cases you will have nothing to change. But be sure to check the migration guide.

Bug Fixes

  • fix XML entities in generated JavaScript (#553) (b3998eb)
  • formatExportName for single names (#548) (5decc94)
  • template: make it possible to use type in template (#619) (5966714), closes #556
  • webpack: fix webpack 5 behaviour with url-loader (1a8cc98)

Features

BREAKING CHANGES

  • Config format of SVGO changes & SVGR does not merge SVGO config
  • Template has a new format
  • core: @svgr/core now exposes { transform } instead of default export
  • using --icon as latest arg now requires "--"
svgr - v6.0.0-alpha.4

Published by gregberge almost 3 years ago

Features

BREAKING CHANGES

  • using --icon as latest arg now requires "--"
svgr - v6.0.0-alpha.2

Published by gregberge almost 3 years ago

Features

svgr - v6.0.0-alpha.3

Published by gregberge almost 3 years ago

Bug Fixes

  • template: make it possible to use type in template (#619) (5966714), closes #556
  • webpack: fix webpack 5 behaviour with url-loader (1a8cc98)

Code Refactoring

Features

BREAKING CHANGES

  • core: @svgr/core now exposes { transform } instead of default export.
svgr - v6.0.0-alpha.1

Published by gregberge almost 3 years ago

Bug Fixes

Features

BREAKING CHANGES

Templates

Template signature has changed, it is now much more simpler to create custom templates. Also you don't have to do anything specific to use TypeScript in your template. If you need some Babel specific things you have to import it by yourself.

v5.x

const template = (
  { template },
  opts,
  { imports, interfaces, componentName, props, jsx, exports }
) => {
  const plugins = ["jsx"];
  if (opts.typescript) {
    plugins.push("typescript");
  }
  const typeScriptTpl = template.smart({ plugins });
  return typeScriptTpl.ast`${imports}

${interfaces}

function ${componentName}(${props}) {
  return ${jsx};
}
${exports}
  `;
};

module.exports = template;

v6.x

const template = (variables, { tpl }) => {
  return tpl`
${variables.imports};

${variables.interfaces};

const ${variables.componentName} = (${variables.props}) => (
  ${variables.jsx}
);
 
${variables.exports};
`;
};

module.exports = template;
svgr - v6.0.0-alpha.0

Published by gregberge about 3 years ago

Bug Fixes

  • fix XML entities in generated JavaScript (#553) (b3998eb)

Features

  • add option to explicitly use named export (#584) (f18ea80)
  • add TypeScript declarations to [@svgr](https://github.com/svgr)/core (#555) (681303a)
  • add webpack typescript preset configuration (#573) (16072d4)
  • upgrade to svgo v2 (1f107af)

BREAKING CHANGES

  • config format of SVGO changes & SVGR does not merge SVGO config.
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