Skip to content

Commit c0c4179

Browse files
authored
Merge pull request #154 from styled-components/bump-version
preparations for v4 bump
2 parents 7128e24 + 4f55115 commit c0c4179

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Vladimir Danchenkov and Maximilian Stoiber
3+
Copyright (c) 2016-present Vladimir Danchenkov and Maximilian Stoiber
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# `babel-plugin-styled-components`
22

3-
This plugin adds support for server-side rendering, for minification of styles and gives you a nicer debugging experience when using `styled-components`.
3+
This plugin is a highly recommended supplement to the base styled-components library, offering some useful features:
4+
5+
* consistently hashed component classNames between environments (a must for server-side rendering)
6+
* automatic library usage tweaks that allow for some bytes to be dropped from your bundle
7+
* better debugging through automatic annotation of your styled components based on their context in the file system, etc.
8+
* various types of minification for styles and the tagged template literals styled-components uses
49

510
## Quick start
611

@@ -18,18 +23,26 @@ Then add it to your babel configuration:
1823
}
1924
```
2025

21-
## [Documentation](https://www.styled-components.com/docs/tooling#babel-plugin)
26+
## styled-components v4 beta
27+
28+
If you are using the styled-components v4 beta, you'll also need to use the beta version of this plugin:
29+
30+
```
31+
npm install --save-dev babel-plugin-styled-components@beta
32+
```
33+
34+
Older versions should technically work, but some of the bundle size reduction benefits are only realized with the newer code!
35+
36+
## Documentation
2237

2338
**The documentation for this plugin lives on [the styled-components website](https://www.styled-components.com/docs/tooling#babel-plugin)!**
2439

25-
- [Usage](https://www.styled-components.com/docs/tooling#usage)
26-
- [Server-side rendering](https://www.styled-components.com/docs/tooling#serverside-rendering)
27-
- [Better debugging](https://www.styled-components.com/docs/tooling#better-debugging)
28-
- [Minification](https://www.styled-components.com/docs/tooling#minification)
29-
- [Preprocessing](https://www.styled-components.com/docs/tooling#preprocessing)
40+
* [Usage](https://www.styled-components.com/docs/tooling#usage)
41+
* [Better debugging](https://www.styled-components.com/docs/tooling#better-debugging)
42+
* [Minification](https://www.styled-components.com/docs/tooling#minification)
3043

3144
## License
3245

33-
Licensed under the MIT License, Copyright © 2016 Vladimir Danchenkov and Maximilian Stoiber.
46+
Licensed under the MIT License, Copyright © 2016-present Vladimir Danchenkov and Maximilian Stoiber.
3447

3548
See [LICENSE.md](./LICENSE.md) for more information.

minification.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Wait, transpiling tagged template literals? Doesn't Babel do this natively?
66

77
## Transpiling tagged template literals
88

9-
You're currently using Babel to transpile your ES2015 JavaScript to ES5-compliant code. one of your presets (`es2015`/`env`/`latest`) includes the `babel-plugin-transform-es2015-template-literals` transform to make tagged template literals work in older browsers, but there is a caveat. Output of that plugin is quite wordy. It's done this way to meet specification requirements:
9+
You're currently using Babel to transpile your ES2015 JavaScript to ES5-compliant code. one of your presets (`es2015`/`env`/`latest`) includes the `babel-plugin-transform-es2015-template-literals` transform to make tagged template literals work in older browsers, but there is a caveat. Output of that plugin is quite wordy. It's done this way to meet specification requirements:
1010

1111
```JS
1212
// processed with babel-preset-latest
1313

1414
var _templateObject = _taggedTemplateLiteral(['width: 100%;'], ['width: 100%;']);
1515
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
1616
var Simple = _styledComponents2.default.div(_templateObject);
17-
```
17+
```
1818

1919
`styled-components` styling code does not require full spec compatibility. This plugin will transpile template literals attached to styled-component to a slightly different form which still works in older browsers but has a much smaller footprint.
2020

@@ -34,19 +34,21 @@ keyframe``
3434
css``
3535

3636
// But this will not be converted
37-
`some text`
37+
'some text'
3838

3939
// In next example outer template literal will be converted because it's attached to component factory,
4040
// but inner template literals will not be touched
41-
styled.div`color: ${ light ? `white` : `black`};`
41+
styled.div`
42+
color: ${ light ? 'white' : 'black'};
43+
;`
4244
```
4345

4446
You can disable this feature with `transpileTemplateLiterals` option:
4547

4648
```JSON
4749
{
4850
"plugins": [
49-
["styled-components", {
51+
["babel-plugin-styled-components", {
5052
"transpileTemplateLiterals": false
5153
}]
5254
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Vladimir Danchenkov <[email protected]>",
88
"Max Stoiber <[email protected]>",
99
"Phil Pluckthun <[email protected]>",
10-
"Evan Scott <[email protected]>"
10+
"Evan Jacobs <[email protected]>"
1111
],
1212
"main": "lib/index.js",
1313
"files": [

0 commit comments

Comments
 (0)