Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(sandbox): use pre-built xds.css with distinct product prefix (#2327)

Cindy Zhang90cc25a03310
diff --git a/apps/sandbox/babel.config.js b/apps/sandbox/babel.config.js
index 782e761990..efbe91d90d 100644
--- a/apps/sandbox/babel.config.js
+++ b/apps/sandbox/babel.config.js
@@ -3,4 +3,10 @@
/* global module, __dirname */
const path = require('path');
const {babel} = require('@xds/build');
-module.exports = babel(path.resolve(__dirname, '../..'));
+
+// Use the dist build pattern: library files keep default 'x' prefix (matching
+// the pre-built xds.css), product files use 'p' prefix to avoid collisions.
+module.exports = babel(path.resolve(__dirname, '../..'), {
+ libraryPrefix: 'x',
+ classNamePrefix: 'p',
+});
diff --git a/apps/sandbox/postcss.config.js b/apps/sandbox/postcss.config.js
index cd6fa562e9..f45189f3a1 100644
--- a/apps/sandbox/postcss.config.js
+++ b/apps/sandbox/postcss.config.js
@@ -6,7 +6,11 @@ const {postcss} = require('@xds/build');
const rootDir = path.resolve(__dirname, '../..');
+// Use 'p' prefix for product-level StyleX classes. Library styles come from
+// the pre-built @xds/core/xds.css (which uses 'x' prefix), so the PostCSS
+// plugin only needs to handle product code here.
module.exports = postcss(rootDir, {
appDir: path.relative(rootDir, path.resolve(__dirname, 'src')),
extraInclude: ['packages/cli/templates/**/*.{ts,tsx}'],
+ classNamePrefix: 'p',
});
diff --git a/apps/sandbox/src/app/globals.css b/apps/sandbox/src/app/globals.css
index 1bb81dacc8..47b5f5dee7 100644
--- a/apps/sandbox/src/app/globals.css
+++ b/apps/sandbox/src/app/globals.css
@@ -2,6 +2,7 @@
@import "./layers.css";
@import "@xds/core/reset.css";
+@import "@xds/core/xds.css";
@import "@xds/theme-default/theme.css";
@import "@xds/theme-neutral/theme.css";
@import "@xds/theme-brutalist/theme.css";