Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:pedronauck/docz
Browse files Browse the repository at this point in the history
* 'master' of github.com:pedronauck/docz:
  chore(docz-plugin-css): typo readme
  chore(docz-plugin-css): change readme
  • Loading branch information
pedronauck committed Jun 21, 2018
2 parents 4ddfe1b + c877878 commit 4bc3bb5
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions packages/docz-plugin-css/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Docz plugin to parse css files inside your documents

![](https://cdn-std.dprcdn.net/files/acc_649651/4Q4QBN)

## Examples

- [PostCSS](https://github.com/pedronauck/docz/tree/master/examples/css-postcss)
- [Less](https://github.com/pedronauck/docz/tree/master/examples/css-less)
- [Sass](https://github.com/pedronauck/docz/tree/master/examples/css-sass)
- [Stylus](https://github.com/pedronauck/docz/tree/master/examples/css-stylus)

## Instalation

First of all, install plugin:
Expand Down Expand Up @@ -48,6 +55,49 @@ export default {
}
```

### Using CSS Modules

To use css modules, just turn on `cssmodules` property on your project configuration:

```js
// doczrc.js
import { css } from 'docz-plugin-css'

export default {
plugins: [
css({
preprocessor: 'sass',
cssmodules: true
})
]
}
```

After that, to import styles from css modules, just use `.module.{preprocessor-ext}` on your files

```markdown
---
name: Button
----

import { Playground } from 'docz'

import { Button } from './Button'
import { styles } from './styles.module.css'

# Button

Example of Button component with custom class!

<Playground>
<Button className={styles.custom}>
Click me
</Button>
</Playground>
```

If you don't pass `.module` in front of the preprocessor extension, bundler will don't parse your css as cssmodule!

### Multiple pre-processor

You can still use multiple pre-processor together in the same configuration:
Expand Down

0 comments on commit 4bc3bb5

Please sign in to comment.