<p>A great thing about <a href="/daily/2023/01/03/tailwind-css-extensibility-is-one-of-its-best-features">Tailwind CSS plugins</a> being written in JavaScript is that they can be tested using tools like Jest.</p>
<p>Here's an example from https://github.com/opdavies/tailwindcss-plugin-jest-example (it may need updating to work with the latest Tailwind versions or to use the latest best practices):</p>
<p>Within the test, Tailwind can be run using PostCSS and generates styles based on a provided configuration, which is then checked against some expected output. If the generated styles match what was expected, the tests pass and the plugin is working as expected.</p>
<p>A great thing about <a href="/daily/2023/01/03/tailwind-css-extensibility-is-one-of-its-best-features">Tailwind CSS plugins</a> being written in JavaScript is that they can be tested using tools like Jest.</p>
<p>Here's an example from https://github.com/opdavies/tailwindcss-plugin-jest-example (it may need updating to work with the latest Tailwind versions or to use the latest best practices):</p>
<p>Within the test, Tailwind can be run using PostCSS and generates styles based on a provided configuration, which is then checked against some expected output. If the generated styles match what was expected, the tests pass and the plugin is working as expected.</p>