Skip to content

fix: detect Tailwind in PostCSS plugins object - #6468

Merged
markdalgleish merged 1 commit into
devfrom
markdalgleish/detect-tailwind-plugin-function
May 24, 2023
Merged

markdalgleish merged 1 commit into
devfrom
markdalgleish/detect-tailwind-plugin-function

Conversation

@markdalgleish

Copy link
Copy Markdown
Member

This fixes a Tailwind performance issue when postcss.config.js contains plugins: { tailwindcss: {} } and remix.config.js contains both tailwind: true and postcss: true. This would cause the Tailwind plugin to be applied twice, with the second run of the plugin effectively being an expensive no-op since all Tailwind syntax has already been processed.

Note that this was not an issue when the plugin function had been explicitly called, i.e. plugins: [tailwindcss()]. Remix avoids adding the Tailwind plugin to PostCSS if it's already present but we were failing to detect when the plugin function hadn't been called — either because the plugin function itself had been passed, i.e. plugins: [require('tailwindcss')], or the plugin config object syntax had been used, i.e. plugins: { tailwindcss: {} }.

@changeset-bot

changeset-bot Bot commented May 24, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e36328b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@remix-run/dev Patch
create-remix Patch
@remix-run/css-bundle Patch
remix Patch
@remix-run/architect Patch
@remix-run/cloudflare Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
@remix-run/deno Patch
@remix-run/eslint-config Patch
@remix-run/express Patch
@remix-run/netlify Patch
@remix-run/node Patch
@remix-run/react Patch
@remix-run/serve Patch
@remix-run/server-runtime Patch
@remix-run/testing Patch
@remix-run/vercel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@markdalgleish
markdalgleish merged commit c90c16e into dev May 24, 2023
@markdalgleish
markdalgleish deleted the markdalgleish/detect-tailwind-plugin-function branch May 24, 2023 01:25
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-c90c16e-20230524 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants