Skip to content

Tailwind Classes In The Database

Stuart George edited this page Dec 3, 2024 · 6 revisions

You will need at some point to add the tailwind classes that are in the html content within the database.

Example

Below is an example sql query to list all css classes found in the page_html table:

WITH extracted AS (
    SELECT unnest(regexp_matches(html, 'class="([^"]*)"', 'g')) AS classes
    FROM page_html
)
SELECT DISTINCT unnest(string_to_array(classes, ' ')) AS class
FROM extracted
ORDER BY class;

Clone this wiki locally