Skip to content

Add support for generating multiple CSS files per page template (e.g. front-page.css, single.css) #199

@mateoworks

Description

@mateoworks

Hi there 👋

I've been working with _tw and really appreciate how streamlined it makes using Tailwind CSS in WordPress themes. However, I noticed that currently, all styles are compiled into a single main.css file.

This works well for small sites, but for larger projects or performance-sensitive builds, it would be great to have the option to split the CSS by page templates — such as:

  • front-page.css
  • home.css
  • single.css
  • archive.css
  • etc.

This would allow developers to enqueue only the necessary styles per page, improving performance metrics like LCP and reducing unused CSS.

Proposal

Could we add support for generating multiple CSS bundles based on templates? This could be optional or follow a pattern similar to how JS is handled.

Alternatively, perhaps the build system (build.js) could be updated to support this out of the box with some guidance in the documentation.

Let me know your thoughts! I'm happy to help draft a PR if this aligns with the project's goals.

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