JoshBee
cat 11ty-and-tailwind.md

11ty and Tailwind

Tailwind setup

I was setting up Tailwind@4 and found this great post by Carlo van Wyk (1), I ran into one issue though, when editing the index.css it was not being watched because it only ran before the 11ty build hook.

The fix

Fixing it was super easy, just add a watcher!

  //  eleventy.config.js
  eleventyConfig.addWatchTarget("./assets/styles/");
  eleventyConfig.on("eleventy.before", async () => {
    const tailwindInputPath = path.resolve("./assets/styles/index.css");
    ...
  })

Resources

(1) 11ty Tailwind Integration