tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Resolve config file relative to the file being transformed instead of cwd

Open mischnic opened this issue 2 years ago • 0 comments

What version of Tailwind CSS are you using?

v3.0.2

What build tool (or framework if it abstracts the build tool) are you using?

Parcel 2 👋

What version of Node.js are you using?

16

What operating system are you using?

macOS

Describe your issue

A "standard" PostCSS config like

const path = require("path");

module.exports = {
  plugins: [
      require('tailwindcss')
  ]
}

causes Tailwind to search for the config file relative to the current working directory because of this

https://github.com/tailwindlabs/tailwindcss/blob/a7263a8f6faf989cb98553491d5c456d0b86de9b/src/util/resolveConfigPath.js#L46-L48

I think it should instead be relative to the file that's being processed. This way you could also have a single project with multiple config files for different parts.

This might have performance downsides if you currently search just once for a config.

mischnic avatar Dec 14 '21 21:12 mischnic