Skip to content

Commit e464bde

Browse files
authored
chore: Remove postcss deps and update css imports for explicit ordering (#2964)
* remove postcss deps and update css imports for explicit ordering * never mind about the components layer, figure it out later * ok put back most of the layer things
1 parent ab76183 commit e464bde

File tree

3 files changed

+25
-183
lines changed

3 files changed

+25
-183
lines changed

app/ui/styles/index.css

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@
88

99
/*
1010
* We import all of these here instead of in the corresponding component files
11-
* so we can control the order things are imported in. In theory that's what the
12-
* @layer directives are for, but Vite's usage of postcss-import didn't seem
13-
* to be aware of the @tailwind directives here. I suspect it was not following
14-
* the order specified in our postcss config. In any case we don't need to worry
15-
* about that if we're controlling the order directly here. All of these end up
16-
* inlined into a single file by postcss-import.
11+
* so we can control the order things are imported in. If we were to import them
12+
* in the component files, the order that the CSS comes in is whatever order the
13+
* component file is bundled in by Vite, which is determined by the import DAG
14+
* and is therefore arbitrary with respect to style precedence.
15+
*
16+
* Tailwind v4 uses native CSS cascade layers (@layer), and the first @layer
17+
* declaration establishes precedence order. Each @import can be assigned to a
18+
* layer using layer() syntax, ensuring predictable specificity regardless of
19+
* import order.
1720
*/
1821

22+
@layer base, components, utilities;
23+
1924
@import 'tailwindcss';
2025

2126
@import '@oxide/design-system/styles/tailwind.css';
@@ -24,19 +29,21 @@
2429

2530
@import './fonts.css' layer(base);
2631
@import './vars.css' layer(base);
27-
@import './components/button.css';
28-
@import './components/menu-button.css';
29-
@import './components/menu-list.css';
30-
@import './components/loading-bar.css';
31-
@import './components/Tabs.css';
32-
@import './components/form.css';
33-
@import './components/login-page.css';
34-
@import './components/mini-table.css';
35-
@import './components/side-modal.css';
36-
@import './components/spinner.css';
32+
@import './components/button.css' layer(components);
33+
@import './components/menu-button.css' layer(components);
34+
@import './components/menu-list.css' layer(components);
35+
@import './components/loading-bar.css' layer(components);
36+
@import './components/Tabs.css' layer(components);
37+
@import './components/form.css' layer(components);
38+
@import './components/login-page.css' layer(components);
39+
@import './components/mini-table.css' layer(components);
40+
@import './components/side-modal.css' layer(components);
41+
@import './components/spinner.css' layer(components);
42+
@import './components/tooltip.css' layer(components);
43+
@import './themes/selection.css' layer(components);
44+
45+
/* layer(components) on this one results in visual changes, holding off for now */
3746
@import './components/table.css';
38-
@import './components/tooltip.css';
39-
@import './themes/selection.css';
4047

4148
@import '@xterm/xterm/css/xterm.css' layer(components);
4249
@source '../../../node_modules/@oxide/design-system/dist';

package-lock.json

Lines changed: 0 additions & 161 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@
123123
"oxlint": "^1.23.0",
124124
"oxlint-tsgolint": "^0.2.0",
125125
"patch-package": "^8.0.0",
126-
"postcss": "^8.4.49",
127-
"postcss-import": "^16.1.0",
128-
"postcss-nesting": "^13.0.1",
129-
"postcss-pseudo-classes": "^0.4.0",
130126
"prettier": "^3.4.2",
131127
"prettier-plugin-tailwindcss": "^0.6.14",
132128
"resize-observer-polyfill": "^1.5.1",

0 commit comments

Comments
 (0)