diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ce6afd6a7..0d1aed03fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,9 +23,12 @@ All notable changes to this project will be documented in this file. If a contri ### Added +- Expose API for Server Side rendering: `styleSheet.reset()` and `styleSheet.getCSS()`, thanks to [@thisguychris](https://github.com/thisguychris), (see [#214](https://github.com/styled-components/styled-components/pull/214)) fixes [#124](https://github.com/styled-components/styled-components/issues/124) - Added support for deeply nested styles in ReactNative (e.g. `transform`), thanks [@jacobp100](https://github.com/jacobp100). (see [#139](https://github.com/styled-components/styled-components/pull/139)) - Added support for camelized style properties in ReactNative (e.g. `fontWeight`), thanks [@jacobp100](https://github.com/jacobp100). (see [#145](https://github.com/styled-components/styled-components/pull/145)) - Properly expose `flow` typings by adding a `flow:build` step and `flow` support docs, thanks to [@ryyppy](https://github.com/ryyppy). (see [#219](https://github.com/styled-components/styled-components/pull/219)) +- Added support for deeply nested styles in ReactNative (e.g. `transform`), thanks [@jacobp100][https://github.com/jacobp100]. (see [#139](https://github.com/styled-components/styled-components/pull/139)) +- Added support for camelized style properties in ReactNative (e.g. `fontWeight`), thanks [@jacobp100][https://github.com/jacobp100]. (see [#145](https://github.com/styled-components/styled-components/pull/145)) ### Changed diff --git a/src/index.js b/src/index.js index 32d7a51404..1ca0513160 100644 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,7 @@ import generateAlphabeticName from './utils/generateAlphabeticName' import css from './constructors/css' import injectGlobal from './constructors/injectGlobal' +import styleSheet from './models/StyleSheet' /* Import singleton constructors */ import _styledComponent from './models/StyledComponent' @@ -20,4 +21,4 @@ const styled = _styled(_styledComponent(_ComponentStyle(generateAlphabeticName)) /* Export everything */ export default styled -export { css, keyframes, injectGlobal, ThemeProvider } +export { css, keyframes, injectGlobal, ThemeProvider, styleSheet } diff --git a/src/models/StyleSheet.js b/src/models/StyleSheet.js index 7b8ec15e37..607d5facb1 100644 --- a/src/models/StyleSheet.js +++ b/src/models/StyleSheet.js @@ -5,4 +5,13 @@ import { StyleSheet } from '../vendor/glamor/sheet' -export default new StyleSheet({ speedy: false, maxLength: 40 }) +class StyleSheetExtended extends StyleSheet { + reset() { + return super.flush() + } + getCSS() { + return super.rules().map(rule => rule.cssText).join('\n') + } +} + +export default new StyleSheetExtended({ speedy: false, maxLength: 40 })