Skip to content

Tailwind build does not re-run when module Pages change, so new utility classes silently never compile #288

Description

@antosubash

Summary

Styles/app.css declares the module pages as Tailwind sources:

@source "../../modules/**/Views/**/*.tsx";
@source "../../modules/**/Pages/**/*.tsx";

The MSBuild target that compiles Tailwind does not treat those globs as inputs. Adding or
editing a page under src/modules/**/Pages/ therefore does not invalidate the CSS, and the
utility classes that page uses are never generated.

The failure is silent. The page renders, some classes work (any that another package happens
to use literally), and the ones unique to your page do nothing.

Reproduction

sm new project MyApp && cd MyApp
sm new module Invoicing
# add Pages/index.ts + Pages/Foo.tsx using grid-cols-4, bg-blue-600, max-w-5xl
npm run build && dotnet build && dotnet run --project src/MyApp.Host

Result

$ grep -c '\.grid-cols-4' src/MyApp.Host/wwwroot/css/app.css
0
$ grep -c '\.bg-blue-600' src/MyApp.Host/wwwroot/css/app.css
0

What this looks like in the browser: a four-column grid renders as four stacked full-width
boxes, and a bg-blue-600 text-white button renders as white text on the page background —
invisible. It reads as a layout bug in your own markup, which is where the time goes.

Touching the stylesheet fixes it:

$ touch src/MyApp.Host/Styles/app.css && dotnet build src/MyApp.Host
$ grep -c '\.grid-cols-4' src/MyApp.Host/wwwroot/css/app.css
1

So the compilation itself is correct — only the staleness check is wrong.

Why it matters

Every developer adding their first page hits this, and the symptom points away from the
cause. The natural conclusion is "my Tailwind classes are wrong" or "the grid utilities are
not included in this setup", not "the CSS on disk predates my file".

Suggested fix

Add the @source globs to the Tailwind target's Inputs so MSBuild's up-to-date check sees
page changes. Failing that, treat src/modules/**/Pages/**/*.tsx and
src/modules/**/Views/**/*.tsx as inputs explicitly, or have sm dev watch them.

Environment

  • SimpleModule.Cli 0.0.39, packages 0.0.39
  • .NET SDK 10.0.201, Node 23.5.0, macOS

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