diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e8233709..32299a6a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,9 +66,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 0875d6105..4b1fe60ae 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' @@ -23,4 +24,4 @@ const styled = _styled(_styledComponent(_ComponentStyle(generateAlphabeticName)) /* Export everything */ export default styled -export { css, keyframes, injectGlobal, ThemeProvider, withTheme } +export { css, keyframes, injectGlobal, ThemeProvider, withTheme, styleSheet } diff --git a/src/models/StyleSheet.js b/src/models/StyleSheet.js index 7b8ec15e3..607d5facb 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 })