diff options
author | Rafael Heard <rafael.heard@gmail.com> | 2024-03-14 19:20:54 +0100 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-03-20 08:46:29 +0100 |
commit | 989dc10cf2fca5ae826c04a707b0c16464d6885c (patch) | |
tree | 32d8990fe9c05a6d7fa41e919c132d7125174274 /webpack.config.js | |
parent | Support GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT env (#29788) (diff) | |
download | forgejo-989dc10cf2fca5ae826c04a707b0c16464d6885c.tar.xz forgejo-989dc10cf2fca5ae826c04a707b0c16464d6885c.zip |
enable tailwind nesting (#29746)
Currently, if you implement native CSS nesting within a Vue component a
warning will appear in the terminal. It states
`Nested CSS was detected, but CSS nesting has not been configured
correctly.
Please enable a CSS nesting plugin *before* Tailwind in your
configuration.` To fix this error we need to enable the built-in
[tailwinds nesting
config](https://tailwindcss.com/docs/using-with-preprocessors#nesting).
Example code to trigger the warning within a vue component:
```CSS
<style>
.example {
&:hover,
&:focus-visible {
color: var(--color-text);
}
& svg {
margin-right: 0.78rem;
}
}
</style>
```
---------
Co-authored-by: rafh <rafaelheard@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 03753cbc0ff68cc4eee0a65b556e6d86a8f1c63f)
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/webpack.config.js b/webpack.config.js index 896d541113..a053771d63 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,6 +13,8 @@ import {readFileSync} from 'node:fs'; import {env} from 'node:process'; import tailwindcss from 'tailwindcss'; import tailwindConfig from './tailwind.config.js'; +import tailwindcssNesting from 'tailwindcss/nesting/index.js'; +import postcssNesting from 'postcss-nesting'; const {EsbuildPlugin} = EsBuildLoader; const {SourceMapDevToolPlugin, DefinePlugin} = webpack; @@ -149,6 +151,7 @@ export default { sourceMap: sourceMaps === 'true', url: {filter: filterCssImport}, import: {filter: filterCssImport}, + importLoaders: 1, }, }, { @@ -156,7 +159,10 @@ export default { options: { postcssOptions: { map: false, // https://github.com/postcss/postcss/issues/1914 - plugins: [tailwindcss(tailwindConfig)], + plugins: [ + tailwindcssNesting(postcssNesting({edition: '2024-02'})), + tailwindcss(tailwindConfig), + ], }, }, } |