Conversation
|
Can we extend the existing new TailwindRspackPlugin({
// now is string type
config: './config.js',
// object
config: {
index: './config/tailwind.index.config.js',
main: './config/tailwind.main.config.js'
},
}) |
|
@luhc228 Thank you for your suggestion. However, according to our design, |
435417f to
582d3a3
Compare
colinaaa
left a comment
There was a problem hiding this comment.
Honestly, I'm not a fan of the multipleConfig concept. It doesn't feel intuitive to me.
Here are some alternative methods:
- Support
@configdirective of Tailwind CSS
This is the best way since it is just how Tailwind CSS works with PostCSS and it does not need extra configuration.
To support @config we need to change processing Tailwind CSS from processAssets to a loader (so that the PostCSS knows about the current file path).
I've implemented a prototype in Tailwind CSS v4, see #17 (comment) for details.
- Use multiple
pluginTailwindCSS
This idea came from the HtmlWebpackPlugin.
export default {
entry: {
foo: './src/foo.js',
bar: './src/bar.js',
},
plugins: [
new TailwindCSSRspackPlugin({
config: './foo/tailwind.config.js',
chunks: ['foo.css'],
}),
new TailwindCSSRspackPlugin({
config: './bar/tailwind.config.js',
chunks: ['bar.css'],
}),
],
}- Use
config: string | ((entryName: string) => string)
Setting Tailwind config path for different entries
multipleConfigcan be configured as an object where the key is the entryName and the value is the config path.If the key cannot be found, it will fallback to
config, which is the default config path.example: