What happens
On a fresh local checkout, any spec that renders the casa_app layout fails:
Sprockets::Rails::Helper::AssetNotPrecompiledError:
Asset `tailwind.css` was not declared to be precompiled in production.
Declare links to your assets in `app/assets/config/manifest.js`.
//= link tailwind.css
and restart your server
./app/views/layouts/casa_app.html.erb:15
For example, three examples in spec/requests/case_court_reports_spec.rb (the index action):
rspec ./spec/requests/case_court_reports_spec.rb:14 # as volunteer can view 'Generate Court Report' page
rspec ./spec/requests/case_court_reports_spec.rb:28 # as a supervisor can view the 'Generate Court Report' page
rspec ./spec/requests/case_court_reports_spec.rb:37 # as a supervisor with no cases in the organization
CI is green — .github/workflows/rspec.yml runs bundle exec rails assets:precompile in its Build App step, so app/assets/builds/tailwind.css exists there. This is purely a local developer experience problem, but it hits anything rendering a casa_app page, which is a growing share of the app as the design migration proceeds.
Why
app/assets/builds/tailwind.css does not exist until someone builds it. Before #7071 ("disable on-demand asset compilation") Sprockets would compile on demand and this worked; now it is a hard failure.
The error message is actively misleading — it tells you to declare the asset in app/assets/config/manifest.js, but the manifest is already correct:
//= link_directory ../builds .css
link_directory only picks up files that exist. The real problem is that nothing has written tailwind.css yet.
Two things worth fixing
1. Document it. Neither the README nor bin/setup mentions that you must build CSS before running specs. npm run build only builds JS — CSS is a separate npm run build:css. Easy to miss, and the resulting error points you at the wrong file.
2. npm run build:css may not work. On my machine it fails outright:
$ npm run build:css
> tailwindcss -i ./app/assets/stylesheets/tailwind.css -o ./app/assets/builds/tailwind.css --minify
sh: tailwindcss: command not found
package.json declares both tailwindcss and @tailwindcss/cli at ^4.3.2, but after npm install, node_modules/@tailwindcss/ is empty and there is no node_modules/.bin/tailwindcss. In Tailwind v4 the CLI binary comes from @tailwindcss/cli, so the script may need to be npx @tailwindcss/cli — or this is an install/lockfile problem specific to my machine (arm64 macOS). Flagging it as an observation rather than a diagnosis; someone should check whether a clean npm ci produces a working tailwindcss binary before changing the script.
Suggested fix
- Have
bin/setup build CSS alongside JS, and/or add a line to the README's testing section
- Confirm
npm run build:css works from a clean npm ci, and fix the script if not
- Optionally, make the failure self-explanatory — a clearer message than Sprockets' default would save the next person the detour through
manifest.js
Context
Found while debugging #7093 — these three failures were initially mistaken for fallout from that work before being traced to missing built assets.
What happens
On a fresh local checkout, any spec that renders the
casa_applayout fails:For example, three examples in
spec/requests/case_court_reports_spec.rb(the index action):CI is green —
.github/workflows/rspec.ymlrunsbundle exec rails assets:precompilein its Build App step, soapp/assets/builds/tailwind.cssexists there. This is purely a local developer experience problem, but it hits anything rendering acasa_apppage, which is a growing share of the app as the design migration proceeds.Why
app/assets/builds/tailwind.cssdoes not exist until someone builds it. Before #7071 ("disable on-demand asset compilation") Sprockets would compile on demand and this worked; now it is a hard failure.The error message is actively misleading — it tells you to declare the asset in
app/assets/config/manifest.js, but the manifest is already correct://= link_directory ../builds .csslink_directoryonly picks up files that exist. The real problem is that nothing has writtentailwind.cssyet.Two things worth fixing
1. Document it. Neither the README nor
bin/setupmentions that you must build CSS before running specs.npm run buildonly builds JS — CSS is a separatenpm run build:css. Easy to miss, and the resulting error points you at the wrong file.2.
npm run build:cssmay not work. On my machine it fails outright:package.jsondeclares bothtailwindcssand@tailwindcss/cliat^4.3.2, but afternpm install,node_modules/@tailwindcss/is empty and there is nonode_modules/.bin/tailwindcss. In Tailwind v4 the CLI binary comes from@tailwindcss/cli, so the script may need to benpx @tailwindcss/cli— or this is an install/lockfile problem specific to my machine (arm64 macOS). Flagging it as an observation rather than a diagnosis; someone should check whether a cleannpm ciproduces a workingtailwindcssbinary before changing the script.Suggested fix
bin/setupbuild CSS alongside JS, and/or add a line to the README's testing sectionnpm run build:cssworks from a cleannpm ci, and fix the script if notmanifest.jsContext
Found while debugging #7093 — these three failures were initially mistaken for fallout from that work before being traced to missing built assets.