Skip to content

Commit

Permalink
Document minify option
Browse files Browse the repository at this point in the history
  • Loading branch information
Igorbek committed Mar 6, 2019
1 parent 39043f3 commit 054ff85
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ interface Options {
identifiers: CustomStyledIdentifiers;
ssr: boolean;
displayName: boolean;
minify: boolean;
}
```

Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand Down
7 changes: 7 additions & 0 deletions src/models/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 054ff85

Please sign in to comment.