This commit is contained in:
Alex
2024-07-06 02:49:25 -04:00
parent 2b3812b2ba
commit d4404f7ae2
11 changed files with 267 additions and 119 deletions

View File

@ -2,7 +2,7 @@ import hash from "@emotion/hash";
import type { Config } from "tailwindcss";
import type { SetRequired } from "type-fest";
import type postcss from "postcss";
import { memoize } from "lodash";
import { memoize, without } from "lodash";
import { type ClassNameCollector, babelTailwind } from "./babel-tailwind";
import { esbuildPlugin } from "./esbuild-postcss";
import { vitePlugin } from "./vite-plugin";
@ -130,7 +130,12 @@ export function getTailwindPlugins(options: TailwindPluginOptions) {
const buildStyleFile: BuildStyleFile = async path => {
const styles = styleMap.get(path)!;
const compiled = await compile(
styles.map(({ className, key }) => `.${key} {\n @apply ${className}\n}`).join("\n")
styles
.map(
({ classNames, key }) =>
`.${key} {\n @apply ${without(classNames, "group").join(" ")}\n}`
)
.join("\n")
);
if (path.endsWith(".css")) {
return ["css", compiled] as const;