Skip to content

Commit

Permalink
Update tailwind, switch to tailwindcss/nesting, move postcss-css-vari…
Browse files Browse the repository at this point in the history
…ables

Fixes #1416
Fixes #1074

As noted in #1416 there's been a change in `tailwindcss` around the
`@apply` directive. In order to get it to work correctly for nested
classes we need to use the `tailswindcss/nesting` plugin. We were already
using `postcss-nested`, which is what `tailwindcss/nesting` uses under
the hood. So this PR just switches them out.

It also moves the `postcss-css-variables` plugin to be higher in the
plugin stack for the mailer stylesheet. [That plugin doesn't play nicely
when it's below the nesting plugin.](MadLittleMods/postcss-css-variables#135 (comment))

Moving `postcss-css-variables` higher in the stack also seems to have
fixed the problems described in #1074. When it's higher in the stack I
see almost zero difference in build times between having it activated or
not, and the resulting stylesheet is actually _smaller_ when it is
activated (~120k vs ~140k).
  • Loading branch information
jagthedrummer committed Apr 3, 2024
1 parent a9cf0b9 commit 574e90f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"postcss-nested": "^6.0.1",
"stimulus-reveal": "^1.4.2",
"stimulus-scroll-reveal": "^3.2.0",
"tailwindcss": "^3.4.1",
"tailwindcss": "^3.4.3",
"yalc": "^1.0.0-pre.53"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
plugins: [
require('postcss-import')(postcssImportConfig),
require('postcss-extend-rule'),
require('postcss-nested'),
require('tailwindcss/nesting'),
require('tailwindcss'),
require('autoprefixer'),
]
Expand Down
4 changes: 2 additions & 2 deletions postcss.mailer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module.exports = {
plugins: [
require('postcss-import')(postcssImportConfig),
require('postcss-extend-rule'),
require('postcss-nested'),
require('tailwindcss'),
require('postcss-css-variables'),
require('tailwindcss/nesting'),
require('tailwindcss'),
require('autoprefixer'),
]
}
18 changes: 9 additions & 9 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 574e90f

Please sign in to comment.