saadeghi/daisyui · error · Error

Use either --css or --css-file, not both

Error message

Use either --css or --css-file, not both

What it means

CSS may be supplied either inline (--css) or from a file (--css-file), but not both. Mirrors the HTML mutual-exclusion rule.

Source

Thrown at packages/tailwind-play-share/index.mjs:114

        options.help = true
        break
      case "--":
        positional.push(...argv.slice(index + 1))
        index = argv.length
        break
      default:
        if (argument.startsWith("-")) {
          throw new Error(`Unknown option: ${argument}`)
        }
        positional.push(argument)
    }
  }

  if (options.html !== undefined && options.htmlFile !== undefined) {
    throw new Error("Use either --html or --html-file, not both")
  }
  if (options.css !== undefined && options.cssFile !== undefined) {
    throw new Error("Use either --css or --css-file, not both")
  }

  if (options.html === undefined && options.htmlFile === undefined && positional.length > 0) {
    options.html = positional.shift()
  }
  if (options.css === undefined && options.cssFile === undefined && positional.length > 0) {
    options.css = positional.shift()
  }
  if (positional.length > 0) {
    throw new Error("Too many positional arguments")
  }

  return options
}

async function readStdin() {
  let input = ""
  for await (const chunk of process.stdin) {

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Remove one of the two flags.
  2. Pick the inline or file form and use it consistently for CSS.

Example fix

# before
bun .../index.mjs --css '@import "tailwindcss";' --css-file styles.css
# after
bun .../index.mjs --css-file styles.css
Defensive patterns

Strategy: validation

Validate before calling

if (options.css !== undefined && options.cssFile !== undefined) {
  throw new Error('Use either --css or --css-file, not both')
}

Prevention

When it happens

Trigger: Passing `--css '<code>' --css-file path.css` together in one invocation.

Common situations: Wrapper that always injects a default --css while the user also passes --css-file; copy-paste accumulation.

Related errors


AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13). Data as JSON: /api/errors/cbd6a043a54b59a0. Report an issue: GitHub.