Skip to content

css-tailwind export emits an extra trailing newline #139

Description

@i3enl

Finding

@google/design.md@0.3.0 emits two trailing newline bytes from the css-tailwind exporter. That is normally harmless, but it makes checked-in generated CSS fail strict whitespace gates such as git diff --check when the exported file is tracked.

Reproduction

Environment observed on macOS with npm and @google/design.md@0.3.0.

cat > DESIGN.md <<'EOF'
---
version: alpha
name: Finding Repro
colors:
  primary: "#000000"
  on-primary: "#ffffff"
components:
  header:
    backgroundColor: "{colors.primary}"
    textColor: "{colors.on-primary}"
---

## Overview

Repro.
EOF

npm init -y
npm install @google/design.md@0.3.0 --no-audit --ignore-scripts
./node_modules/.bin/designmd export --format css-tailwind DESIGN.md > out.css
python3 - <<'PY'
from pathlib import Path
b = Path('out.css').read_bytes()
print(repr(b[-20:]))
print(len(b) - len(b.rstrip(b'\n')))
PY

Observed:

b'rimary: #ffffff;\n}\n\n'
2

Expected:

b'rimary: #ffffff;\n}\n'
1

Why it matters

Agent and CI workflows often check generated artifacts with git diff --check. A deterministic exporter that emits a single final newline avoids each consumer needing a tiny trimming wrapper.

Current workaround

In downstream DSA adoption PR ZhuLinsen/daily_stock_analysis#1813, I added a local normalizer script for the checked-in design-theme.css export.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions