Skip to content

Commit 260d9a1

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 6b87a2e + 9f65c2a commit 260d9a1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,37 @@
33
Remove unnecessary statics attached to React components for different build environments
44

55
## Usage
6+
Set the statics you want via babel configuration with boolean.
7+
8+
This can be particularly useful if you want to switch certain statics on/off for certain environments. An example of this would be using something like [react-styleguide-generator-alt](https://github.com/theogravity/react-styleguide-generator-alt) for your documentation. Since that tool requires you to attach a static ```styleguide``` to your components, you probably would want to remove it in production. But you would probably want to keep it to actually build your doc server, and then remove PropTypes still. This babel plugin gives you that flexibility.
69

710
### Via `.babelrc` (Recommended)
811
Simply pass in the name of the static you want removed during build and set a boolean. If true, the static will be removed, if false, the static will stay attached to the component.
912

10-
This can be particularly useful if you want to switch certain statics on/off for certain environments. An example of this would be using something like [react-styleguide-generator-alt](https://github.com/theogravity/react-styleguide-generator-alt) for your documentation. Since that tool requires you to attach a static ```styleguide``` to your components, you probably would want to remove it in production. But you would probably want to keep it to actually build your doc server, and then remove PropTypes still. This babel plugin gives you that flexibility.
11-
1213
**.babelrc**
1314

1415
```json
1516
{
1617
"env": {
1718
"production": {
18-
"plugins": ["transform-react-remove-statics", {
19-
"propTypes": true
20-
}]
19+
"plugins": [
20+
["transform-react-remove-statics", {
21+
"propTypes": true
22+
}]
23+
]
24+
}
2125
}
2226
}
2327
```
2428
### Via Node API
2529

2630
```js
2731
require("babel-core").transform("code", {
28-
plugins: ["transform-react-remove-statics", {
29-
"propTypes": true
30-
}]
32+
plugins: [
33+
["transform-react-remove-statics", {
34+
"propTypes": true
35+
}]
36+
]
3137
});
3238
```
3339

@@ -65,4 +71,4 @@ MIT
6571

6672
This project was originally a fork of [Babel Plugin Transform React Remove PropTypes](https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types), by [oliviertassinari](https://github.com/oliviertassinari), which is in turn a fork of [Babel Plugin React Remove PropTypes](https://github.com/nkt/babel-plugin-react-remove-prop-types) by [nkt](https://github.com/nkt).
6773

68-
Thank you [nkt](https://github.com/nkt) and [oliviertassinari](https://github.com/oliviertassinari) for letting em stand on your shoulders.
74+
Thank you [nkt](https://github.com/nkt) and [oliviertassinari](https://github.com/oliviertassinari) for letting me stand on your shoulders.

0 commit comments

Comments
 (0)