Skip to content

[v4] __unstable__loadDesignSystem candidatesToCss can not get correct result #13123

@hyoban

Description

@hyoban

What version of Tailwind CSS are you using?

4.0.0-alpha.5

What build tool (or framework if it abstracts the build tool) are you using?

vite 5.1.5, @tailwindcss/vite 4.0.0-alpha.5

What version of Node.js are you using?

v20.11.1

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

https://github.com/hyoban-repro/tailwindcss-compile-candidates

Describe your issue

I want to use candidatesToCss to get the corresponding output for className.

import { __unstable__loadDesignSystem } from 'tailwindcss';

const css = `
@import "tailwindcss";

@theme {
  --font-family-display: "Satoshi", "sans-serif";

  --breakpoint-3xl: 1920px;

  --color-neon-pink: oklch(71.7% 0.25 360);
  --color-neon-lime: oklch(91.5% 0.258 129);
  --color-neon-cyan: oklch(91.3% 0.139 195.8);
}
`
const designSystem = __unstable__loadDesignSystem(css)

console.log(designSystem.candidatesToCss([
  'max-w-lg',
  '3xl:max-w-xl',
  'font-display',
  'text-4xl',
  'text-neon-cyan'
]))

All of this should be valid className, but the output is:

[
  null,
  null,
  '.font-display {\n  font-family: "Satoshi", "sans-serif";\n}\n',
  null,
  '.text-neon-cyan {\n  color: oklch(91.3% 0.139 195.8);\n}\n'
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions