Description
Steps to reproduce
(rm -rf depot; \
rails new depot -j esbuild --css tailwind; \
cd depot; \
bin/rails generate scaffold Product title:string; \
grep class app/views/products/show.html.erb)
Expected behavior
The generated view should contain class attributes utilizing tailwind classes.
Actual behavior
No class attribute are defined
Additionally, errors are produced when generating the tailwind class:
rails css:install:tailwind
Build into app/assets/builds
exist app/assets/builds
identical app/assets/builds/.keep
- File unchanged! The supplied flag value not found! app/assets/config/manifest.js
Stop linking stylesheets automatically
gsub app/assets/config/manifest.js
- File unchanged! The supplied flag value not found! .gitignore
- File unchanged! The supplied flag value not found! .gitignore
Remove app/assets/stylesheets/application.css so build output can take over
remove app/assets/stylesheets/application.css
Add stylesheet link tag in application layout
- File unchanged! The supplied flag value not found! app/views/layouts/application.html.erb
append Procfile.dev
Add bin/dev to start foreman
identical bin/dev
Install Tailwind (+PostCSS w/ autoprefixer)
create tailwind.config.js
create app/assets/stylesheets/application.tailwind.css
run yarn add tailwindcss@latest postcss@latest autoprefixer@latest from "."
Note: no errors are produced, and class attributes making use of tailwind classes are added if the -j esbuild
option is removed from the rails
command in the test case above.
Analysis/commentary
The tailwindcss_rails gem has a nice feature whereby it provides Tailwind styled scaffold templates: rails/tailwindcss-rails#71
Rails, by default, will install tailwindcss_rails via tailwindcss:install
unless the js option is specified, see:
rails/railties/lib/rails/generators/app_base.rb
Lines 326 to 330 in 8380816
This was added with the following commit:
8380816#diff-a83245368df35c610a37260d0a51041de89211857d47cfd0b2d1301a11709164R409-R412
Likely one of the following two options will need to be done to fix this problem:
css:install:tailwind
(and therefore, cssbundling-rails) will install tailwindcss_rails in addition to what it is currently doing- rails will need to install both cssbundling-rails and tailwindcss_rails
Either way, the errors produced by css:install:tailwind
should be addressed.
System configuration
Rails version:
Rails 7.0.0.alpha2
Ruby version:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]