styled-jsx
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "styled-jsx", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "zeit/styled-jsx", |
@@ -198,25 +198,9 @@ # styled-jsx | ||
### `styled-jsx/flush` | ||
### Advanced APIs | ||
In the server rendering pipeline, you can obtain the entire CSS of all components by invoking `flush`: | ||
Low level APIs are also available: | ||
```js | ||
import flush from 'styled-jsx/flush' | ||
- `styled-jsx/flush`: exports a method that returns the existing memory (see below) and resets it | ||
- `styled-jsx/memory`: exports the `Object` holding the references to used styles. DOM on the client, strings on server | ||
// … | ||
// <render here> | ||
// … | ||
const styles = flush() | ||
for (let id in styles) { | ||
const css = styles[id] | ||
console.log(id, css) | ||
} | ||
``` | ||
This API is also available on the client: Instead of returning the CSS text, it returns a reference to the automatically generated `<style>` tag. | ||
This is useful for performing diffs of elements between top-level `render()` calls, and ditching style elements that are no longer being used. | ||
## Credits | ||
@@ -223,0 +207,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15
780
42668
218