tailwind2-1 Exercise 1: What Gets Scanned ======================================= Run this in an empty folder that has Tailwind installed (npm install tailwindcss @tailwindcss/cli). It is bash; on Windows use Git Bash. rm -rf audit && mkdir -p audit/src audit/node_modules/ui-kit audit/dist audit/content audit/assets && cd audit git init -q printf 'dist/\n' > .gitignore echo '
page
' > src/index.html echo 'Use green' > content/post.md echo 'export const c = "text-blue-500";' > node_modules/ui-kit/widget.js echo 'built
' > dist/built.html echo '.text-purple-500 { color: purple; }' > src/old.css printf 'text-pink-500' > assets/logo.png echo '@import "tailwindcss";' > input.css check() { npx @tailwindcss/cli -i "$1" -o out.css >/dev/null 2>&1 for c in red green blue yellow purple pink; do grep -q "^ \.text-$c-500 " out.css && printf '%s ' $c; done; echo; } echo "1) defaults:"; check input.css cat > step2.css <<'EOF' @import "tailwindcss"; @source "./node_modules/ui-kit"; EOF echo "2) + @source ./node_modules/ui-kit:"; check step2.css cat > step3.css <<'EOF' @import "tailwindcss"; @source "./node_modules/ui-kit"; @source not "./content"; EOF echo "3) + @source not ./content:"; check step3.css cat > step4.css <<'EOF' @import "tailwindcss" source(none); @source "./src"; @source "./node_modules/ui-kit"; EOF echo "4) source(none) + two folders:" ; check step4.css Output: 1) defaults: red green 2) + @source ./node_modules/ui-kit: red green blue 3) + @source not ./content: red blue 4) source(none) + two folders: red blue WHY THIS WORKS AS AN ANSWER --------------------------- Prediction for step 1 (defaults): red (src/index.html), green (the Markdown post: any text file is scanned). Not blue (node_modules is always skipped), not yellow (dist/ is in .gitignore), not purple (CSS files are never scanned), not pink (a PNG is binary). The run agrees. There is no git repo problem either: the script runs git init, but the ignore file is read without one too. Step 2: @source "./node_modules/ui-kit" adds that folder and overrides the node_modules rule, so blue appears. Step 3: @source not "./content" drops the Markdown post, so green goes. Step 4: source(none) turns the automatic scan off, so only the folders you list are read: src and node_modules/ui-kit. The result is the same red and blue, but now it is the whole list of what Tailwind may read, instead of a list of exceptions. purple and pink never appear in any step, because a file type that is not scanned stays unscanned even if you name its folder.