Skip to content

Commit

Permalink
Add the variants factory plugin's documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine4livre committed Nov 30, 2023
1 parent 2ab1f01 commit 2790db8
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ Have a look at the [small guide](https://tailwind-config.meta.fr) for informatio
This project uses [Git Flow](https://github.com/petervanderdoes/gitflow-avh) as a branching model and a combination of [ESlint](https://eslint.org/) and [Prettier](https://prettier.io/) to lint the JS files. You can lint your modifications when contributing with the following commands:

```bash
# Lint all files in the src/ folder
# Lint all files in the packages/ folder
$ npm run lint

# Lint files and test build files
$ npm run test
# Start the dev server for the test's assets
$ npm run test:dev

# Build the test's assets
$ npm run test:build

# Start the dev server for the documentation
$ npm run docs:dev

# Build the documentation
$ npm run docs:build
```
1 change: 1 addition & 0 deletions packages/docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
{ text: 'Breakpoint', link: '/plugins/breakpoint.html' },
{ text: 'Font-Face', link: '/plugins/font-face.html' },
{ text: 'Grid', link: '/plugins/grid.html' },
{ text: 'Variants factory', link: '/plugins/variants-factory.html' },
{ text: 'Typography', link: '/plugins/typography.html' },
],
},
Expand Down
1 change: 1 addition & 0 deletions packages/docs/configuration/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ module.exports = {
- [Breakpoint](/plugins/breakpoint.html) to exposes the `screens` configuration in the CSS
- [Font-Face](/plugins/font-face.html) to easily add custom `@font-face` declarations
- [Grid](/plugins/grid.html) to add some grid classes
- [Variants Factory](/plugins/variants-factory.html) to add custom variants on the go
- [Typography](/plugins/typography.html) to improve the typography utilities

---
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/plugins/grid.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar: auto
prev: ./font-face.html
next: ./typography.html
next: ./variants-factory.html
---

# Grid
Expand Down
27 changes: 27 additions & 0 deletions packages/docs/plugins/variants-factory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
sidebar: auto
prev: ./grid.html
next: ./typography.html
---

# Variants factory

The variants factory plugin creates simple custom variants on the go and simply is a shorthand for [`addVariant` Tailwind plugin](https://tailwindcss.com/docs/plugins) default functionality.

## Configuration

The plugin can be configured with the `theme.customVariants` property:

```js{3-5}
module.exports = {
theme: {
customVariants: {
children: '& > *', // like addVariant('children', '& > *')
},
},
};
```

::: tip
You should add new custom variants to your project via the `theme.extend` property to not override these defaults.
:::

0 comments on commit 2790db8

Please sign in to comment.