Skip to content

keep interpolations in CSS on their own declarations when the formatter reorders them - #264

Open
UnknownPlatypus wants to merge 2 commits into
g-plane:mainfrom
UnknownPlatypus:fix-interpolation-order-upstream
Open

UnknownPlatypus wants to merge 2 commits into
g-plane:mainfrom
UnknownPlatypus:fix-interpolation-order-upstream

Conversation

@UnknownPlatypus

Copy link
Copy Markdown
Contributor

The CSS external formater can reorder declaration, which can move interpolations around (For ex malva with the declarationOrder setting).

It would result in such changes which breaks behavior:

<style>
-  .a { width: {{ width }}; height: {{ height }} }
+  .a { height: {{ width }}; width: {{ height }} }
</style>

The new implementation adds an index id to the placeholder so we can restore the correct interpolation after the formating.

I've added an integration test with malva to showcase the issue and validate the fix

  • The pull request description was written manually by me and was not generated by an AI tool or agent.
  • I have read and understood the relevant parts of the existing codebase before making these changes.
  • I have carefully reviewed and understood all code changes, and ensured that they match the style, architecture, and conventions of the existing codebase.
  • I understand that pull requests containing blindly generated or unreviewed AI-generated code may be closed without review.

@netlify

netlify Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for markup-fmt ready!

Name Link
🔨 Latest commit 66d530d
🔍 Latest deploy log https://app.netlify.com/projects/markup-fmt/deploys/6aa904d10abcbe0008080173
😎 Deploy Preview https://deploy-preview-264--markup-fmt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@UnknownPlatypus
UnknownPlatypus force-pushed the fix-interpolation-order-upstream branch from 66d530d to d591d93 Compare November 28, 2026 07:03
@netlify

netlify Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

👷 Deploy request for markup-fmt pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9b7b689

@g-plane

g-plane commented Nov 28, 2026

Copy link
Copy Markdown
Owner

This case is special enough so we can move that test into a separated #[test] function in integrated.rs and we don't need to change existing integration_with_dprint_ts_snapshot test. In that test, markup_fmt usage and malva usage can be hard-coded.

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