-
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
Auto source detection improvements #14820
Conversation
Noticed some files weren't properly formatted, this fixes that by using: - `npm run format` - `cargo clippy --fix`
We used to list `core` instead of `oxide`, this should make sure that building Oxide works if we make changes in `oxide/`.
Typically we wrap the `exec(…)` in integration tests with a console log when focusing on a test. Let's do this by default now.
Whenever we dump the generated CSS file, it will contain a license header. If we later bump the version, then the tests start failing. In the tests we don't care about the header so let's ignore it there.
f0cf898
to
58a8a4c
Compare
And handle the `source(…)` on the `@tailwind utilities` at-rule. In addition, we also track the `@tailwind utilities` node while traversing it once. This allows us to skip an entire walk.
We will be applying auto source detection on normal sources found via `@source` as well. This means that we don't need a distinction between sources and detect sources. The only difference would be that in the clients (`@tailwindcss/vite`, `@tailwindcss/postcss` and `@tailwindcss/cli`), you pass everything as a single array of sources.
9835a1d
to
b766949
Compare
This is an existing bug that we’re going to fix separately
This PR fixes Windows related path issues after merging #14820 --------- Co-authored-by: Jordan Pittman <jordan@cryptica.me>
I have a Laravel project where I separated the frontend and backend. I have the following paths for example. Backend: Frontend: I was loading individual tailwind.config.js for each part, can we load multiple sources ? Thanks. |
@xcrap |
Thank you, I'm using configs in the CSS, thanks for the reply :) |
This PR introduces a new
source(…)
argument and improves on the existing@source
. The goal of this PR is to make the automatic source detection configurable, let's dig in.By default, we will perform automatic source detection starting at the current working directory. Auto source detection will find plain text files (no binaries, images, ...) and will ignore git-ignored files.
If you want to start from a different directory, you can use the new
source(…)
next to the@import "tailwindcss/utilities" layer(utilities) source(…)
.E.g.:
Most people won't split their source files, and will just use the simple
@import "tailwindcss";
, because of this reason, you can usesource(…)
on the import as well:E.g.:
Sometimes, you want to rely on auto source detection, but also want to look in another directory for source files. In this case, yuo can use the
@source
directive:However, you don't need to specify the extension, instead you can just point the directory and all the same automatic source detection rules will apply.
If, for whatever reason, you want to disable the default source detection feature entirely, and only want to rely on very specific glob patterns you define, then you can disable it via
source(none)
.Note: even with
source(none)
, if your@source
points to a directory, then auto source detection will still be performed in that directory. If you don't want that, then you can simply add explicit files in the globs as seen in the previous example.