-
-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21256d3
commit d4096c6
Showing
3 changed files
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { theme } from "./theme"; | ||
import type { PluginOptions } from "./types"; | ||
import { resolveClassList, resolvePrefix } from "./utils"; | ||
|
||
import type { Config } from "tailwindcss"; | ||
|
||
export function getConfig(options: PluginOptions = {}): Partial<Config> { | ||
return { | ||
safelist: getSafelist(options), | ||
theme: { | ||
extend: theme, | ||
}, | ||
}; | ||
} | ||
|
||
export function getSafelist(options: PluginOptions = {}): Config["safelist"] { | ||
return resolvePrefix(resolveClassList(options.components), options.prefix, options.separator); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import plugin from "tailwindcss/plugin"; | ||
import { theme } from "./theme"; | ||
import { getConfig } from "./config"; | ||
import { PluginOptions } from "./types"; | ||
import { resolveClassList, resolvePrefix } from "./utils"; | ||
|
||
export default plugin.withOptions<PluginOptions>( | ||
// plugin | ||
() => () => {}, | ||
// config | ||
({ prefix, separator, components } = {}) => ({ | ||
safelist: resolvePrefix(resolveClassList(components), prefix, separator), | ||
theme: { | ||
extend: theme, | ||
}, | ||
}), | ||
(options) => getConfig(options), | ||
); |