Customizing components
RailsFast components are meant to be edited. The defaults are great, but your product should look like your product.
If you want to customize a component provided by RailsFast, here’s the simplest workflow:
- Copy the component out of the RailsFast folder before editing: take the partial from
app/views/components/railsfast/...and copy it intoapp/views/components/... - Edit your component: restyle, change layout, edit copy, whatever
- Keep upstream updates clean: since your customized component lives outside
components/railsfast, you can keep pulling template updates without getting messy conflicts in your edited files.
One useful idea is to ask an AI to refactor the Tailwind classes of a component you'd like restyled. It works best if you also paste a “reference” of what you like (a picture, or HTML code), so the AI can get the vibe better
If you'd rather override the RailsFast components themselves in place, you'd need to add it to the .gitattributes file with merge=ours, like this:
app/views/components/marketing/_hero.html.erb merge=ours
So that when I update the RailsFast template and you do fetch the changes, you don't get your custom component overriden by the upstream template changes.