Welcome to Lato
This is the official documentation. A short guide on how to customize a new project.
These pages were generated by downloading the rendered HTML templates from Lato's dummy app.
Some features might not be available. To use the full documentation, you need to run the gem locally using the following commands:
$ git clone https://github.com/lato-org/lato $ cd lato $ bundle $ rails db:migrate $ rails db:seed $ foreman start -f Procfile.dev
Getting Started
To create custom presentation pages for your project, you can modify the ApplicationController
by extending the Lato::ApplicationController
class and specifying the use of Lato's layout:
class ApplicationController < Lato::ApplicationController layout 'lato/application' def index; end end
Source code: Example
Source code: Lato::ApplicationController
How to Hide the Sidebar
To hide the sidebar, you can use one of the methods provided by the Lato::Layoutable
concern (already included via Lato::ApplicationController
):
class ApplicationController < Lato::ApplicationController layout 'lato/application' def index hide_sidebar end end
To apply this rule to all controller actions, you can quickly use before_action
:
class ApplicationController < Lato::ApplicationController layout 'lato/application' before_action :hide_sidebar def index; end def other_action; end end
How to Use Custom CSS and Customize Bootstrap
To customize Lato's CSS, you can modify your main application's application.scss
file:
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap'); // Override bootstrap variables $font-family-base: 'Lato' !default; $primary: #03256C; // Import Lato CSS @import 'lato/application'; // Add custom CSS pre { border-radius: 15px; }
Source code: Example
Source code: Bootstrap SCSS Variables
How to Use Custom Stimulus JS Controllers
Stimulus JS is a dependency of Lato and can be used normally without specific integrations.
Below is an example of using a custom controller hello_controller.js
and a Lato controller lato_hello_controller.js
:
Notes
All controllers handled by Lato are named, by definition, lato_name_controller.js
.
Example: lato_hello_controller.js
is used with the attribute data-controller="lato-hello"
.