Skip to content
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

Handle new source(…) #14767

Closed
wants to merge 28 commits into from
Closed

Handle new source(…) #14767

wants to merge 28 commits into from

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Oct 23, 2024

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.:

/* ./src/styles/index.css */
@import 'tailwindcss/utilities' layer(utilities) source('../../');

Most people won't split their source files, and will just use the simple @import "tailwindcss";, because of this reason, you can use source(…) on the import as well:

E.g.:

/* ./src/styles/index.css */
@import 'tailwindcss' source('../../');

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:

/* ./src/index.css */
@import 'tailwindcss';

/* Look for `blade.php` files in `../resources/views` */
@source '../resources/views/**/*.blade.php';

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.

/* ./src/index.css */
@import 'tailwindcss';

@source '../resources/views';

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).

/* Completely disable the default auto source detection */
@import 'tailwindcss' source(none);

/* Only look at .blade.php files, nothing else  */
@source "../resources/views/**/*.blade.php";

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.

/* Completely disable the default auto source detection */
@import 'tailwindcss' source(none);

/* Run auto source detection in `../resources/views` */
@source "../resources/views";

Copy link
Member Author

RobinMalfait commented Oct 23, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @RobinMalfait and the rest of your teammates on Graphite Graphite

@RobinMalfait RobinMalfait force-pushed the robin/hide_skipped_tests branch from 614cb89 to 5700c5d Compare October 23, 2024 18:27
Base automatically changed from robin/hide_skipped_tests to next October 23, 2024 18:52
@RobinMalfait RobinMalfait force-pushed the robin/handle_source_ branch 4 times, most recently from 45edace to a87e28c Compare October 25, 2024 11:16
@RobinMalfait RobinMalfait marked this pull request as ready for review October 25, 2024 20:26
@RobinMalfait RobinMalfait requested a review from a team as a code owner October 25, 2024 20:26
Forward it from `@media source(…)` to `@tailwind utilities source(…)`.
Next, handle `@tailwind utilities source(…)` and retrieve the path.
This integration test itself might change over time as we work through
this PR.
We used to list `core` instead of `oxide`, this should make sure that
building Oxide works if we make changes in `oxide/`.
@RobinMalfait
Copy link
Member Author

closed in favor of #14820

thecrypticace added a commit to tailwindlabs/tailwindcss-intellisense that referenced this pull request Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants