Skip to content

Commit 20c7490

Browse files
committed
Add changelog for 2.x.x
1 parent f42d8ad commit 20c7490

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

CHANGELOG.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Changelog
2+
3+
## 2.0.0
4+
5+
### Drops Node 0.12 support & webpack 1 support
6+
7+
Tests are run on Node 4, 6, and 8
8+
9+
### Output change from component class to arrow function
10+
11+
Previously, the output of the react-svg-loader was -
12+
13+
```js
14+
import React from "react";
15+
export default class SVG extends React.Component {
16+
render() {
17+
return <svg {...this.props}>{svgContent}</svg>;
18+
}
19+
}
20+
```
21+
22+
and now it is -
23+
24+
```js
25+
import React from "react";
26+
export default props => <svg {...props}>{svgContent}</svg>;
27+
```
28+
29+
### Overridable classnames (to use with css-modules)
30+
31+
Previously, class values are NOT transformed. Now they are transformed such that the output component can be used with css-modules
32+
33+
```js
34+
<svg class="foo bar">
35+
```
36+
37+
is transformed to
38+
39+
```js
40+
<svg className={ (styles["foo"] || "foo") + " " + (styles["bar"] || "bar") }>
41+
```
42+
43+
So, you can pass/override some styles in the svg, for example -
44+
45+
```js
46+
import Image from "react-svg-loader!./image.svg";
47+
import styles from "./styles.css"; // with css-modules
48+
49+
const imageStyles = {
50+
foo: styles.foo,
51+
bar: styles.bar
52+
}
53+
54+
let component = <Image styles={imageStyles} />
55+
```
56+
57+
### Drop option `es5`
58+
59+
Previously, you could do,
60+
61+
```js
62+
{
63+
loader: "react-svg-loader",
64+
options: {
65+
es5: true
66+
}
67+
}
68+
```
69+
70+
and get output transpiled to ES5 using babel-preset-es2015.
71+
72+
This is now deprecated and the **recommended** way to use react-svg-loader is to use it with [babel-loader](https://github.com/babel/babel-loader)
73+
74+
```js
75+
{
76+
test: /\.svg$/,
77+
use: [
78+
"babel-loader",
79+
"react-svg-loader"
80+
]
81+
}
82+
```
83+
84+
and with [babel-preset-env](https://github.com/babel/babel-preset-env) in `.babelrc`:
85+
86+
```json
87+
{
88+
"presets": [
89+
[
90+
"env",
91+
{
92+
"target": {
93+
"browsers": "IE > 11"
94+
}
95+
}
96+
]
97+
]
98+
}
99+
```

0 commit comments

Comments
 (0)