I recently went through the process of configuring Rails to use Roux's boilerplate.
The main gotcha is that Rails 8 with Propshaft doesn't support @import so you need to use a CSS bundler (AFAIK).
I went with PostCSS because it's supported within cssbundling-rails although I appreciate there are faster options.
I documented my steps which are effectively a re-usable script. Putting it here first for feedback, but then maybe we could document this somewhere to help others?
# Roux on Rails
# How to set up Roux within a Rails app. Assumes Rails 8 (ie. `suspenders new <app_name>`).
# Copy Roux's CSS into css/
npx github:thoughtbot/roux init
# Move Roux's CSS into Rails' expected stylesheets directory
mv css/* app/assets/stylesheets/
# Tidy up unused defaults
# WARNING: Avoid this if you already have styles
# You will need to port them manually
rm app/assets/stylesheets/application.css
rm -r css/
# Install cssbundline-rails gem
bundle add cssbundling-rails
# Ensure yarn is installed
npm install --global yarn
# Install PostCSS for CSS bundling
bin/rails css:install:postcss
# Rename app.css to expected PostCSS format
mv app/assets/stylesheets/{app,application.postcss}.css
# NOTE: You can avoid a bunch of these steps if you `rails new myapp --css postcss`
I recently went through the process of configuring Rails to use Roux's boilerplate.
The main gotcha is that Rails 8 with Propshaft doesn't support
@importso you need to use a CSS bundler (AFAIK).I went with PostCSS because it's supported within cssbundling-rails although I appreciate there are faster options.
I documented my steps which are effectively a re-usable script. Putting it here first for feedback, but then maybe we could document this somewhere to help others?