Skip to content

Proposal: add docs about how to use custom TailwindCSS v4 #862

@kowyo

Description

@kowyo

I would like to add docs about how to use custom TailwindCSS v4 without overriding the theme

some users may have the same question: #682, the solution in https://github.com/bep/hugo-testing-tailwindcss-v4/tree/main may still not be polished and it does not adapt for Hextra.

My current solution:

  1. Add a package.json which includes package tailwind/postcss, just like https://github.com/imfing/hextra/blob/main/package.json
  2. In assets/css, add styles.css and import original CSS from Hextra:
@import "../../themes/hextra/assets/css/styles.css";
  1. When adding your own custom TailwindCSS class, you can compile them using npm run build:css, which is actually running:
npx postcss --config postcss.config.mjs --env production assets/css/styles.css -o assets/css/compiled/main.css

Then done! Your website is rendered with your own custom TailwindCSS class!

Let me know if it is a good idea to add the above to the hextra docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions