-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config.content should be resolved relative to the config file for PostCSS dependencies #6516
Comments
@mischnic Hey! So I think this is a totally valid idea, however this would be a breaking change, so it's not inconsequential from our perspective. It honestly might mean it has to wait until v4.0. It's too bad you didn't get this to us about a week ago — we just launched v3.0 last Thursday 😫 That said, maybe there is still something we can do to help. If you can provide more information on why this is important for Parcel (what's the primary issue you're trying to solve?), maybe there's another way to fix it. For example, maybe we can add an option in Tailwind to toggle this behavior. Practically speaking for us, we haven't had any users over the last four years report this as an issue — at least that we can remember. |
Here's an example of how this is broken with just PostCSS CLI and printing the messages: https://github.com/mischnic/tailwind-issue-6516 Run Then [
{
plugin: 'tailwindcss',
parent: undefined,
type: 'dir-dependency',
dir: '.../tailwind-issue-6516/src',
glob: '**/*.html'
},
{
plugin: 'tailwindcss',
parent: undefined,
type: 'dependency',
file: '.../tailwind-issue-6516/src/index.js'
},
{
plugin: 'tailwindcss',
parent: undefined,
type: 'dependency',
file: '.../tailwind-issue-6516/tailwind.config.js'
}
] But then [
{
plugin: 'tailwindcss',
parent: undefined,
type: 'dir-dependency',
dir: '.../tailwind-issue-6516/src/src',
glob: '**/*.html'
},
{
plugin: 'tailwindcss',
parent: undefined,
type: 'dependency',
file: '.../tailwind-issue-6516/src/src/index.js'
},
{
plugin: 'tailwindcss',
parent: undefined,
type: 'dependency',
file: '.../tailwind-issue-6516/tailwind.config.js'
}
] And furthermore (I hadn't noticed this until now), the classes used in the code aren't actually detected in the second case. So this isn't only about the dependencies being wrong So the fundamental question here is how you want
|
This is an issue in angular workspaces as well. Having config file path: content: [
'./projects/app/src/**/**.ts'
] rather than content: [
'./src/**/**.ts'
] |
This comment was marked as spam.
This comment was marked as spam.
This is a problem for Wordpress themes also where all template files live in the root folder. |
Tailwind CLI user here. This is unexpected pain point. The documentation states files referenced in the content section of tailwind.config.js should be relative to the "project root." But, that does not make sense always. For example, I am using tailwind CLI with a build system, please.build, that copies files into an |
I'm also a (new) Tailwind CLI user. Having a I'm also using a build system that moves files to a temp dir and this makes things a little more difficult.
Perhaps a boolean Regards, |
Just wasted 3 hours on this. If this can't be fixed soon, at least mention this in the documentation somewhere. Or suggest using absolute paths. |
Imagine how much more time you would have wasted if you had to build the entire CSS framework yourself instead of leveraging years of other peoples' work for free? Nothing is perfect, don't be a dick dude — I have absolutely zero patience for that. |
Hey, sorry @adamwathan. |
If it helps anyone, project root refers to the directory tailwind CLI is invoked from. Maybe it was easy to miss, at least for me, but the @mischnic has stated this clearly:
To make the CLI work as intended, switching to the directory containing |
We've prepped a feature for v3.2 (in #9396) that will allow you to do this! You can specify your content paths like so and we will look for them relative to the config file: module.exports = {
content: {
relative: true,
files: [
"./src/pages/**/*.js",
"./src/components/**/*.js",
],
},
// …
} This is available in our insiders release which you can install using Thanks for your patience! ✨ |
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
If you have a tailwind config file like
, 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".tailwindcss/src/lib/setupTrackingContext.js
Line 160 in a7263a8
and then
path.resolve(file)
resolved it relative to the cwd. It should bepath.resolve(path.dirname(configPath), file)
instead:tailwindcss/src/util/parseDependency.js
Lines 37 to 39 in a7263a8
This results in a PostCSS dependency message with a filepath of
${cwd}/index.html
, regardless of where that file is actually located.The text was updated successfully, but these errors were encountered: