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

Make PostCSS plugin async to improve performance #11548

Merged
merged 3 commits into from Jul 5, 2023

Conversation

RobinMalfait
Copy link
Contributor

This PR improves the performance by making the main plugin async. This means that we can replace a bunch of fs.readFileSync calls for each template file with a Promise.all(f => fs.promises.readFile(f)) instead, without blocking IO.

@RobinMalfait RobinMalfait changed the title Make main plugin async, to improve performance Make PostCSS plugin async to improve performance Jul 4, 2023
This way we can improve the `fs.readFileSync` to a bunch of
`fs.promises.readFile` in a `Promise.all` instead.
@RobinMalfait RobinMalfait force-pushed the feat/performance-improvement-async branch from 8b5a56f to 9d55f9f Compare July 5, 2023 14:01
@RobinMalfait RobinMalfait merged commit 01d1b9a into master Jul 5, 2023
10 checks passed
@RobinMalfait RobinMalfait deleted the feat/performance-improvement-async branch July 5, 2023 14:19
thecrypticace pushed a commit that referenced this pull request Jul 13, 2023
* make main plugin async

This way we can improve the `fs.readFileSync` to a bunch of
`fs.promises.readFile` in a `Promise.all` instead.

* make CLI plugin async

* update CHANGELOG
thecrypticace pushed a commit that referenced this pull request Jul 13, 2023
* make main plugin async

This way we can improve the `fs.readFileSync` to a bunch of
`fs.promises.readFile` in a `Promise.all` instead.

* make CLI plugin async

* update CHANGELOG
thecrypticace pushed a commit that referenced this pull request Jul 13, 2023
* make main plugin async

This way we can improve the `fs.readFileSync` to a bunch of
`fs.promises.readFile` in a `Promise.all` instead.

* make CLI plugin async

* update CHANGELOG
@codemile
Copy link

FYI: This change broke support for NativeWind on React Native. Triggers a "Use process(css).then(cb) to work with async plugins" error when running 3.3.3.

Any insight from the Tailwind team on the reasons? I suspect the error is being thrown by Babel.

@lahaxearnaud
Copy link

FYI: This change also break the postCss plugin postcss-multiple-tailwind.

@robbevp
Copy link

robbevp commented Aug 21, 2023

FYI: This change also break the postCss plugin postcss-multiple-tailwind.

I created postcss-multiple-tailwind, but since tailwindcss v2.3 there has been internal support for this functionality. You should use that instead of my plugin.

@Jorge-Ortiz-Mata
Copy link

Jorge-Ortiz-Mata commented Oct 26, 2023

Error!
This PR did something wrong! I'm getting an internal error server status 500.
I'm not sure what's going on but it must be solved.

@Grenish
Copy link

Grenish commented Dec 19, 2023

Use process(css).then(cb) to work with async plugins is what I'm getting.

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.

None yet

6 participants