Skip to content

fix(client): include stylesheets imported after CSS comments - #457

Merged
ftfgithub merged 2 commits into
mdiri-ai:mainfrom
Afloat16:fix/stylesheet-import-comments
Nov 18, 2026
Merged

ftfgithub merged 2 commits into
mdiri-ai:mainfrom
Afloat16:fix/stylesheet-import-comments

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem and behavior

A valid @import followed by a comment and a quoted filename is skipped by dependency discovery. Portable website deliveries then omit the imported stylesheet and its assets.

Comment skipping is now limited to the value after @import. The shared helper consumes whitespace only, so literal comment-like content inside url(...) remains part of the URL. For example, url(/*comment*/image.png) is preserved as /*comment*/image.png; delivery capture rejects this unsupported literal path instead of silently packaging image.png while leaving the original CSS unchanged.

Review follow-up

Commit 4ef8c8dde92c081a6a47540c0fc049e3e5f6fe01 addresses the requested parser correction. The regressions cover leading, repeated, unterminated, quoted and mid-path comment-like URL text, as well as a URL-valued import. Two real capture cases deliberately provide the stripped-name image or stylesheet that the incorrect parser would select. Both now reject the unsupported literal path and preserve the CSS. The original quoted-import regression continues to pass.

Validation

  • Final focused regressions on the preceding head 6497ce84: 3 failed, 9 passed. On the current fix: 12 passed.
  • Related delivery package, path, worker and lifecycle suites: 43 passed.
  • Passed node tools/check-public-source.cjs, node tools/check-third-party.cjs, node tools/check-docs.cjs, repository-layout checks and python3 tools/security/scan_secrets.py --download with pinned Gitleaks 8.30.1.
  • Node syntax checks and git diff --check pass.
  • Full client npm test was attempted in the isolated checkout but did not complete or pass. Runtime/build dependencies including electron, app-builder-lib, js-yaml and ssh2 were absent; the run was stopped after repeated missing-dependency failures. No complete client-suite pass is claimed.
  • The preceding head passed the official Source checks and Source secret scan. CI for the new head is tracked separately.
  • Platform: Linux, Node.js v24.22.1. Desktop GUI and Windows/macOS acceptance were not exercised.
  • Each commit includes the DCO sign-off. No dependencies or public schemas change.

Signed-off-by: Afloat <ShuffleMonkey@163.com>

@ftfgithub ftfgithub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the missed stylesheet imports. There is one regression to address before merging: whitespace() is shared by @import and url(, but comment-like text inside an unquoted URL is part of that URL.

For background-image:url(/*comment*/image.png), Chromium retains /*comment*/image.png, while this PR discovers image.png. The delivery capture now succeeds and packages image.png without changing the CSS, so the delivered page still requests a different path. Previously this unsupported path was rejected.

Please skip comments only when parsing the value after @import; keep whitespace-only handling after url(. Add coverage for literal comment-like URL paths and the capture behavior so this fix cannot silently produce an incomplete delivery.

Limit comment skipping to the value after @import so unquoted url() paths retain their literal content during delivery discovery.

Signed-off-by: Afloat <ShuffleMonkey@163.com>
@Afloat16

Copy link
Copy Markdown
Contributor Author

Fixed in 4ef8c8dde92c081a6a47540c0fc049e3e5f6fe01. Comment skipping now runs only in the @import value branch; the shared whitespace helper again consumes whitespace only. Literal comment-like content after url( is retained, including a leading /*...*/, whitespace before it, repeated or unterminated comment-like text, and url(...) used by an import.

The capture regressions deliberately create the files that the incorrect stripped paths would select. On the previous head, capture silently succeeds for both an image URL and an imported stylesheet URL; after the fix, both reject the unsupported literal path and leave the CSS unchanged. The original quoted-import/comment regression remains green.

The final focused file gives 3 failed / 9 passed on 6497ce84 and 12 passed after the fix. The related delivery suites pass 43 tests. Public-source, third-party, documentation, repository-layout and pinned Gitleaks checks pass. Full client npm test was attempted but did not complete or pass: this isolated checkout lacks runtime/build dependencies including electron, app-builder-lib, js-yaml and ssh2; it was stopped after repeated missing-dependency failures. Verified on Linux with Node.js 24.22.1; desktop GUI and Windows/macOS acceptance remain outside this verification.

@ftfgithub ftfgithub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! The import-comment handling now preserves literal URL paths as well. This resolves the earlier blocking issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants