Skip to content

Commit

Permalink
Only scan src in client directory for Tailwind to prevent unnecessary…
Browse files Browse the repository at this point in the history
… rebuilds

https://tailwindcss.com/docs/content-configuration#styles-rebuild-in-an-infinite-loop

This speeds up the FE production build from 60s to ~21s on my machine, and also speeds up hot rebuilds to just ~3s
  • Loading branch information
laymonage committed May 17, 2024
1 parent 4f5ffa8 commit c8aeee9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Changelog
* Docs: Document Wagtail's bug bounty policy (Jake Howard)
* Maintenance: Use `DjangoJSONEncoder` instead of custom `LazyStringEncoder` to serialize Draftail config (Sage Abdullah)
* Maintenance: Refactor image chooser pagination to check `WAGTAILIMAGES_CHOOSER_PAGE_SIZE` at runtime (Matt Westcott)
* Maintenance: Exclude the `client/scss` directory in Tailwind content config to speed up CSS compilation (Sage Abdullah)


6.1.1 (xx.xx.xxxx) - IN DEVELOPMENT
Expand Down
1 change: 1 addition & 0 deletions docs/releases/6.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ depth: 1

* Use `DjangoJSONEncoder` instead of custom `LazyStringEncoder` to serialize Draftail config (Sage Abdullah)
* Refactor image chooser pagination to check `WAGTAILIMAGES_CHOOSER_PAGE_SIZE` at runtime (Matt Westcott)
* Exclude the `client/scss` directory in Tailwind content config to speed up CSS compilation (Sage Abdullah)


## Upgrade considerations - changes affecting all projects
Expand Down
7 changes: 6 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ module.exports = {
content: [
'./wagtail/**/*.{py,html,ts,tsx}',
'./wagtail/**/static_src/**/*.js',
'./client/**/*.{js,ts,tsx,mdx}',
// Make sure NOT to include the `client/scss` directory,
// even if we don't specify `*.scss` files here.
// The directory would still be scanned for files, which would cause
// the styles to rebuild in a loop.
// https://tailwindcss.com/docs/content-configuration#styles-rebuild-in-an-infinite-loop
'./client/src/**/*.{js,ts,tsx,mdx}',
'./docs/**/*.{md,rst}',
],
corePlugins: {
Expand Down

0 comments on commit c8aeee9

Please sign in to comment.