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

Improve glob handling for folders with (, ), [ or ] in the file path #12715

Merged
merged 4 commits into from Jan 5, 2024

Conversation

RobinMalfait
Copy link
Contributor

This PR fixes an issue where we assumed that (, ), [ and ] were already properly escaped. This wasn't the case, let's fix it.

This is also going to be a nice DX improvement for people using file based routers where the files and folders can contain any of the following characters: ()[]

In this PR, we will make sure to escape those characters, and we will also ensure that we don't double escape them if you already escaped them yourselfs. This means that the following 2 snippets will be equivalent:

/** @type {import\('tailwindcss').Config} */
module.exports = {
  content: [
    "./src/1.html",
    "./src/(test)/2.html",
    "./src/[test]/3.html",
    "./src/[test]/(test)/4.html",
    "./src/*/(test)/4.html",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};
/** @type {import\('tailwindcss').Config} */
module.exports = {
  content: [
    "./src/1.html",
    "./src/\\(test\\)/2.html",
    "./src/\\[test\\]/3.html",
    "./src/\\[test\\]/\\(test\\)/4.html",
    "./src/*/\\(test\\)/4.html",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};

Fixes: #12708

@RobinMalfait RobinMalfait changed the title Improve glob handling for folders with (, ), [ or ] in the file pat Improve glob handling for folders with (, ), [ or ] in the file path Jan 5, 2024
@RobinMalfait RobinMalfait merged commit a5ae318 into master Jan 5, 2024
10 checks passed
@RobinMalfait RobinMalfait deleted the fix/issue-12708 branch January 5, 2024 16:23
KrisBraun pushed a commit that referenced this pull request Feb 23, 2024
…le path (#12715)

* sync package-lock.json

* modify `normalizePath` to keep `\\[`, `\\]`, `\\(` and `\\)` into account

* manually escape () and [] characters in globs

* update changelog
KrisBraun pushed a commit that referenced this pull request Feb 23, 2024
…le path (#12715)

* sync package-lock.json

* modify `normalizePath` to keep `\\[`, `\\]`, `\\(` and `\\)` into account

* manually escape () and [] characters in globs

* update changelog
thecrypticace added a commit that referenced this pull request Mar 27, 2024
thecrypticace added a commit that referenced this pull request Mar 27, 2024
* Revert "Improve glob handling for folders with `(`, `)`, `[` or `]` in the file path (#12715)"

This reverts commit f2a7c2c.

* Update changelog
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.

Paths containing both brackets and parenthesis are not watched
1 participant