Propshaft - Serving your own static CSS files
If you write your CSS yourself (as opposed to writing SASS → or
using CSS from a library →), you can place all the files
in the folder app/assets/stylesheets
. The files are automatically picked up
if you generated your project with Rails 8.
If you upgraded from a previous version of Rails, make sure that the file
app/layouts/application.html.erb
contains the line
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
inside the <head>
tag.
This makes sure that all your stylesheets from app/assets/stylesheets
are
included in the page.
How to use in development
Static CSS files from your app/assets/stylesheets
folder are automatically served in development mode. No need for any
additional configuration.
How to use in production
Static CSS files from your app/assets/stylesheets
folder are automatically copied to the public/assets
folder during precompilation. They are then served automatically.