Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate semicolon in built CSS styles #13179

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

simonporter007
Copy link

@simonporter007 simonporter007 commented Feb 7, 2025

WHY are these changes introduced?

Fixes #13151

Came across this issue when trying to add tailwind v4 to a Shopify app template. Tailwind has switched CSS parsers in v4, and the vite plugin now errors if the app imports the Polaris styles with the error:

[plugin:@tailwindcss/vite:generate:serve] Unexpected semicolon
.../node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@shopify/polaris/build/esm/styles.css

WHAT is this pull request doing?

This PR removes the semi-colons from the shopify-react mixins which cause the double semicolons in the final built CSS file. It also removes the semicolon from the shadow button primary variable from within polaris-tokens, which was causing an additional duplicate semicolon.

How to 🎩

  • Storybook styling should remain unaffected
  • Using the tailwindcss v4 parser should not throw errors

To test with tailwind, you should:

  • Go get the latest release of tailwind on GitHub at https://github.com/tailwindlabs/tailwindcss/releases/ and find the appropriate one for your operating system. Make sure it is executable if necessary.
  • Write a small input.css file that imports the shopify polaris built CSS file:
@import './build/esm/styles.css';
  • Parse the file with ./tailwindcss --input input.css --output output.css

N.B. It should be possible to recreate the error by parsing the styles.css before these changes were made (or in a separate existing project that uses shopify polaris):

@import './node_modules/@shopify/polaris/build/esm/styles.css';

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

🎩 checklist

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.

A build error on Vite
1 participant