config.content should be resolved relative to the config file for PostCSS dependencies
See original GitHub issueWhat 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
If you have a tailwind config file like
module.exports = {
content: ["index.html"],
theme: {
extend: {},
},
plugins: [],
}
, I think content
should be relative to that config file.
However, it is resolved relative to the process’s working directory.
fileOrGlob
here is “index.html”.
and then path.resolve(file)
resolved it relative to the cwd. It should be path.resolve(path.dirname(configPath), file)
instead:
This results in a PostCSS dependency message with a filepath of ${cwd}/index.html
, regardless of where that file is actually located.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Content Configuration - Tailwind CSS
Using relative paths. By default Tailwind resolves non-absolute content paths relative to the current working directory, not the tailwind.config.js file.
Read more >No PostCSS config found - webpack - Stack Overflow
Made a new file in the root directory named postcss.config.js and added. module.exports = {};. Found this on the following post:.
Read more >Shared Options - Vite
When aliasing to file system paths, always use absolute paths. Relative alias values will be used as-is and will not be resolved into...
Read more >postcss-loader | webpack - JS.ORG
You can use different postcss.config.js files in different directories. Config lookup starts from path.dirname(file) and walks the file tree upwards until a ...
Read more >Configuration | Stylelint
stylelintrc file (without extension) can be in JSON or YAML format. You can add a filename extension to help your text editor provide...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a problem for Wordpress themes also where all template files live in the root folder.
This is an issue in angular workspaces as well. Having
tailwind.config.js
in one of the project doesn’t resolve relative paths correctly after updating to v3. One has to provide full path from the root.config file path:
projects/app/tailwind.config.js
rather than