Adding a .gitignore file to a directory referenced by a @source directive in a Tailwind CSS source file causes the referenced directory to be ignored.
Having the directory referenced by a @source directive in the top-level .gitignore has no effect as expected.
Note: text- blue -500 is written below so that the CLI doesn't accidentally source from this README.
- Clone this repo
- Run
npm install - Ignore the
ignoreddirectory:echo ignored >> .gitignore. (optional, this just demonstrates documented behavior) - Build
main.css:$ npx @tailwindcss/cli -i base.css -o main.css
- As expected,
text-red-500(fromtest.html) andtext- blue -500(fromignored/template.html) are inmain.css$ grep 'text-\(red\|blue\)-500' main.css .text-red-500 { .text- blue -500 { - Add a
.gitignorefile to theignoreddirectory:$ echo '*' > ignored/.gitignore
- Build
main.cssagain and observe thattext- blue -500is now missing inmain.css:$ grep 'text-\(red\|blue\)-500' main.css .text-red-500 {