Install Ruby and Rails on your system. Use rvm.
\curl -sSL https://get.rvm.io | bash -s stable --rails
then
Create a new project with Rails.
rails new your-project-name --database=sqlite3
And cd into it.
The database is optional, you can add it later.
Install.
bundle install
If you added a database, create it.
bin/rails db:create
Install Hotwire
bin/rails hotwire:install
Create some pages, I'll create home, about, posts and contact.
bin/rails generate controller Pages home about posts contact
bin/rails This can be changed later.
Run it
bin/rails server
Now you can edit your pages in app/views/pages/...
. These are ruby files, you should write Ruby and HTML in here. Don't write CSS or JS in here.
CSS:
To change global styles, edit app/assets/stylesheets/application.css
.
To change the style for a specific page, create and edit app/assets/stylesheets/pages/pagename.css
e.g. home.css
.
JS:
To write page-specific scripts, edit app/controllers/pagename_controller.js
e.g. home_controller.js
, then attach it in your page's .erb file like this:
<div data-controller="home">
...
</div>
The app will automatically reload when you make changes.