Skip to content

Commit

Permalink
Merge pull request #352 from BJJLangedijk/feat/plugins
Browse files Browse the repository at this point in the history
fix: allow for plugin options to be passed
  • Loading branch information
nado1001 authored Apr 20, 2024
2 parents 4d91125 + f6fddf0 commit f714479
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ yarn add sd-tailwindcss-transformer

### Creating configuration file

Generate `tailwind.config.js` by setting type to `all`.
Generate `tailwind.config.js` by setting type to `all`.
See [Creating each theme file](https://github.com/nado1001/sd-tailwindcss-transformer#creating-each-theme-file) if you wish to customize the configuration file with [plugin functions](https://tailwindcss.com/docs/plugins), etc.

```js
Expand Down Expand Up @@ -64,7 +64,7 @@ module.exports = {

### Creating each [theme](https://tailwindcss.com/docs/configuration#theme) file

Create an object for each theme, assuming that various customizations will be made in the configuration file.
Create an object for each theme, assuming that various customizations will be made in the configuration file.
Import and use the created files in `tailwind.config.js`.

```js
Expand Down Expand Up @@ -106,7 +106,7 @@ module.exports = {

### Using CSS custom variables

CSS custom variables can be used by setting isVariables to `true`.
CSS custom variables can be used by setting isVariables to `true`.
In this case, a CSS file must also be generated.

```js
Expand Down Expand Up @@ -186,19 +186,19 @@ Please see [Example](https://github.com/nado1001/sd-tailwindcss-transformer/tree

Optional except for `type`.

| Attribute | Description | Type |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| type | Set the name of each theme (colors, fontSize, etc.) for `'all'` or tailwind. | `'all'` or string |
| formatType | Set the format of the Tailwind CSS configuration file. <br>Default value: `js` | `'js'` `'cjs'` |
| isVariables | Set when using CSS custom variables. <br>Default value: `false` | boolean |
| extend | Set to add transformed styles to the `'extend'` key within the `'theme'` key or not. <br>Default value: `true` | boolean |
| source | [`source`](https://github.com/amzn/style-dictionary/blob/main/README.md#configjson) attribute of style-dictionary.<br>Default value: ` ['tokens/**/*.json']` | Array of strings |
| transforms | [`platform.transforms`](https://github.com/amzn/style-dictionary/blob/main/README.md#configjson) attribute of style-dictionary.<br>Default value: `['attribute/cti','name/cti/kebab']` | Array of strings |
| buildPath | [`platform.buildPath`](https://github.com/amzn/style-dictionary/blob/main/README.md#configjson) attribute of style-dictionary.<br>Default value: `'build/web/'` | string |
| prefix | [`platform.prefix`](https://github.com/amzn/style-dictionary/blob/main/types/Platform.d.ts#L21) attribute of style-dictionary.<br>Valid when using css variables (isVariables: true) | string |
| tailwind.content | [Content](https://tailwindcss.com/docs/content-configuration) attribute of Tailwind CSS. Set if necessary when 'all' is set in type. <br>Default value: `['./src/**/*.{ts,tsx}']` | Array of strings |
| tailwind.darkMode | [Dark Mode](https://tailwindcss.com/docs/dark-mode#toggling-dark-mode-manually) attribute of Tailwind CSS. Set if necessary when 'all' is set in type. <br>Default value: `'class'` | `'media'` `'class'` |
| tailwind.plugin | Tailwind CSS [official plugins](https://tailwindcss.com/docs/plugins#official-plugins). Set if necessary when 'all' is set in type. | Array of `'typography'` `'forms'` `'aspect-ratio'` `'line-clamp'` `'container-queries'` |
| Attribute | Description | Type |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| type | Set the name of each theme (colors, fontSize, etc.) for `'all'` or tailwind. | `'all'` or string |
| formatType | Set the format of the Tailwind CSS configuration file. <br>Default value: `js` | `'js'` `'cjs'` |
| isVariables | Set when using CSS custom variables. <br>Default value: `false` | boolean |
| extend | Set to add transformed styles to the `'extend'` key within the `'theme'` key or not. <br>Default value: `true` | boolean |
| source | [`source`](https://github.com/amzn/style-dictionary/blob/main/README.md#configjson) attribute of style-dictionary.<br>Default value: `['tokens/**/*.json']` | Array of strings |
| transforms | [`platform.transforms`](https://github.com/amzn/style-dictionary/blob/main/README.md#configjson) attribute of style-dictionary.<br>Default value: `['attribute/cti','name/cti/kebab']` | Array of strings |
| buildPath | [`platform.buildPath`](https://github.com/amzn/style-dictionary/blob/main/README.md#configjson) attribute of style-dictionary.<br>Default value: `'build/web/'` | string |
| prefix | [`platform.prefix`](https://github.com/amzn/style-dictionary/blob/main/types/Platform.d.ts#L21) attribute of style-dictionary.<br>Valid when using css variables (isVariables: true) | string |
| tailwind.content | [Content](https://tailwindcss.com/docs/content-configuration) attribute of Tailwind CSS. Set if necessary when 'all' is set in type. <br>Default value: `['./src/**/*.{ts,tsx}']` | Array of strings |
| tailwind.darkMode | [Dark Mode](https://tailwindcss.com/docs/dark-mode#toggling-dark-mode-manually) attribute of Tailwind CSS. Set if necessary when 'all' is set in type. <br>Default value: `'class'` | `'media'` `'class'` |
| tailwind.plugin | Tailwind CSS [official plugins](https://tailwindcss.com/docs/plugins#official-plugins). Set if necessary when 'all' is set in type. | Array of `'typography'` `['typography', options]` `'forms'` `['forms', options]` `'aspect-ratio'` `'line-clamp'` `'container-queries'` |

## License

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type SdObjType<T extends Record<string, any>> = {

export type TailwindOptions = Pick<TailwindConfig, 'content' | 'darkMode'> & {
plugins: Array<
'typography' | 'forms' | 'aspect-ratio' | 'line-clamp' | 'container-queries'
'typography' | ['typography', { className?: string, target?: 'modern' | 'legacy' }] | 'forms' | ['forms', { strategy?: 'base' | 'class' }] | 'aspect-ratio' | 'line-clamp' | 'container-queries'
>
}
export type TailwindFormatType = 'js' | 'cjs'
Expand Down

0 comments on commit f714479

Please sign in to comment.