From 054ff8573c5f342c62ff79f660281b72014ab930 Mon Sep 17 00:00:00 2001 From: Igor Oleinikov Date: Wed, 6 Mar 2019 00:42:57 -0800 Subject: [PATCH] Document `minify` option --- README.md | 17 +++++++++++++++++ src/models/Options.ts | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/README.md b/README.md index 2c2d78f..db3d2b2 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ interface Options { identifiers: CustomStyledIdentifiers; ssr: boolean; displayName: boolean; + minify: boolean; } ``` @@ -190,6 +191,16 @@ To disable `displayName` generation set this option to `false` Default value is `true` which means that display name is being injected. +### `minify` + +The option allows to turn on minification of inline styles used in styled components. +It is similar to [`babel-plugin-styled-components`](https://github.com/styled-components/babel-plugin-styled-components)'s same option. +The minification is not exactly the same and may produce slightly different results. + +:warning: **Warning**: The minification is an experimental feature, please use with care. + +Default value is `false` which means the minification is not being performed. + ### `identifiers` This option allows to customize identifiers used by `styled-components` API functions. @@ -201,11 +212,17 @@ This option allows to customize identifiers used by `styled-components` API func interface CustomStyledIdentifiers { styled: string[]; attrs: string[]; + keyframes: string[]; + css: string[]; + createGlobalStyle: string[]; } ``` - `styled` - list of identifiers of `styled` API (default `['styled']) - `attrs` - list of identifiers of `attrs` API (default `['attrs']) +- `keyframes` - list of identifiers of `keyframes` API (default `['keyframes']) +- `css` - list of identifiers of `css` API (default `['css']) +- `createGlobalStyle` - list of identifiers of `createGlobalStyle` API (default `['createGlobalStyle']) Example diff --git a/src/models/Options.ts b/src/models/Options.ts index cf2fb94..01e659d 100644 --- a/src/models/Options.ts +++ b/src/models/Options.ts @@ -31,6 +31,13 @@ export interface Options { */ displayName: boolean; + /** + * Allow minifying of inline styles in styled functions. + * The minification is an experimental feature, please use with care. + * + * @defaultValue `false` + * @experimental The minification feature is experimental. + */ minify: boolean; }