Skip to content

v1.6.0

Compare
Choose a tag to compare
@nighca nighca released this 22 Jan 04:04
· 166 commits to master since this release

#41 Update deps

Breaking Changes

[email protected], may cause questions:

  • Weak Type Detection. Check the linked page for solution.
  • React Components' typings error (caused by question 1). Solution: upgrade React typings package.

The new way to import svg files

We used to do:

const fooIcon = require('./foo.svg')

Value of fooIcon is a string, and we can use it like this:

<svg>
  <use
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xlink:href={fooIcon}
  ></use>
</svg>

Now we just import svg files and use the default export:

import fooIcon from './foo.svg'

Now we can use fooIcon just the same as before.

If you uses Typescript, you need to add a type declaration file (for example, svg.d.ts):

declare let svgExport: string

declare module '*.svg' {
  export default svgExport
}