Skip to content

Commit ef0e5fd

Browse files
committed
import from specific postcss files for smaller bundle size
1 parent ff43b73 commit ef0e5fd

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

packages/tailwind/src/utils/css/resolve-all-css-variables.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import {
2-
type Root,
3-
type Node,
4-
type Declaration,
5-
Rule,
6-
rule as createRule,
7-
decl as createDeclaration,
8-
AtRule,
9-
} from "postcss";
1+
import type { Node, Root } from "postcss";
2+
import Declaration from "postcss/lib/declaration";
3+
import Rule from "postcss/lib/rule";
4+
import AtRule from "postcss/lib/at-rule";
105
import { removeIfEmptyRecursively } from "./remove-if-empty-recursively";
116

127
const doNodesMatch = (first: Node | undefined, second: Node | undefined) => {
@@ -49,7 +44,7 @@ export const resolveAllCSSVariables = (root: Root) => {
4944
) {
5045
const atRule = otherDecl.parent.parent;
5146

52-
const clonedDeclaration = createDeclaration();
47+
const clonedDeclaration = new Declaration();
5348
clonedDeclaration.prop = decl.prop;
5449
clonedDeclaration.value = decl.value.replaceAll(
5550
variable,
@@ -84,7 +79,7 @@ export const resolveAllCSSVariables = (root: Root) => {
8479
}
8580

8681
for (const [atRule, declarations] of declarationsForAtRules.entries()) {
87-
const equivalentRule = createRule();
82+
const equivalentRule = new Rule();
8883
equivalentRule.selector = rule.selector;
8984
equivalentRule.append(...declarations);
9085

packages/tailwind/src/utils/tailwindcss/setup-tailwind.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Rule } from "postcss";
2-
import { parse } from "postcss";
2+
import parse from "postcss/lib/parse";
33
import evaluateTailwindFunctions from "tailwindcss/lib/lib/evaluateTailwindFunctions";
44
import expandApplyAtRules from "tailwindcss/lib/lib/expandApplyAtRules";
55
import resolveDefaultsAtRules from "tailwindcss/lib/lib/resolveDefaultsAtRules";

0 commit comments

Comments
 (0)