Skip to content

Commit

Permalink
fix: always render style() comps on extract addon
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 22, 2018
1 parent c6e779a commit 2657001
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions addon/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ exports.addon = function (renderer) {
// Render styled component once with default props
// to extract its static CSS and "default" dynamic CSS.
if (style) {
renderer.style = function (tag, css, dynamicTemplate) {
renderer.style = function () {
var styledComponent = style.apply(this, arguments);

if (typeof dynamicTemplate === 'function') {
process.nextTick(function () {
styledComponent(styledComponent.defaultProps || {});
});
}
process.nextTick(function () {
styledComponent(styledComponent.defaultProps || {});
});

return styledComponent;
};
Expand Down
2 changes: 1 addition & 1 deletion docs/Addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ plenty more to chose from. Below is a list of addons shipped with `nano-css`.
- [`array`](./array.md) — use arrays to specify multiple values
- [`snake`](./snake.md) — chain styling rules
- [`rtl`](./rtl.md) — flips all styles RTL (right-to-left)
- [`extract`](./extract.md) — allows extraction of CSS into external style sheet
- [`extract`](./extract.md) — allows extraction of CSS into external `*.css` style sheet

## Addon Installation

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nano-css",
"version": "1.8.0",
"version": "1.9.0",
"description": "Smallest 5th gen CSS-in-JS library",
"main": "index.js",
"unpkg": "dist/nano-css.umd.min.js",
Expand Down

0 comments on commit 2657001

Please sign in to comment.