


Ruby on Rails - Frontend Rápido com Frameworks CSS Classless ou Classlight
Start a New Rails Application
- The time before the rails command is used to display its execution time at the end of the command execution. In the example below, it took 47 seconds.
$ rails -v Rails 8.0.0 $ time rails new classless-css --asset-pipeline propshaft --skip-test ... real 0m47.500s user 0m33.052s sys 0m4.249s
Open the project with VSCode or your preferred editor
$ cd classless-css && code .
Knowing the Rails Standard Master Layout app/views/layouts/application.html.erb.
Show more…
<!DOCTYPE html>
<html>
<head>
<title><%= content_for(:title) || "Classless Css" %></title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= yield :head %>
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
<link rel="icon" href="/icon.png" type="image/png">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/icon.png">
<%# Includes all stylesheet files in app/assets/stylesheets %>
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
Generate Test Pages, with a controller pages and the actions html_test_1, html_test_2, html_test_3 and html_test_4
Show more…
$ rails g controller pages html_test_1 html_test_2 html_test_3 html_test_4
create app/controllers/pages_controller.rb
route get "pages/html_test_1"
get "pages/html_test_2"
get "pages/html_test_3"
get "pages/html_test_4"
invoke erb
create app/views/pages
create app/views/pages/html_test_1.html.erb
create app/views/pages/html_test_2.html.erb
create app/views/pages/html_test_3.html.erb
create app/views/pages/html_test_4.html.erb
invoke helper
create app/helpers/pages_helper.rb
Open the config/routes.rb file in VSCode
$ rails -v
Rails 8.0.0
$ time rails new classless-css --asset-pipeline propshaft --skip-test
...
real 0m47.500s
user 0m33.052s
sys 0m4.249s
Displaying Rails Routes
Using the terminal you can display the routes by specifying a controller (with -c), for example from controller pages Or you can display all routes with It is also possible to access the routes through the browser using the address http://127.0.0.1:3000/rails/info/routes. Don't forget to start the development server with bin/dev or the standard rails server with rails server from your project's root directory. The development server “listens” for changes in javascript files and css files to carry out the necessary processing to make them available to users. For changes to these files to be made and viewed instantly in the browser, it is necessary to install a gem such as Rails Livre Reload.Show more…
$ cd classless-css && code .
<!DOCTYPE html>
<html>
<head>
<title><%= content_for(:title) || "Classless Css" %></title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= yield :head %>
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
<link rel="icon" href="/icon.png" type="image/png">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/icon.png">
<%# Includes all stylesheet files in app/assets/stylesheets %>
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
Let's create four pages with HTML content to test the CSS styles.
Insert the Page Content for the html_test_1 action
Access the link https://github.com/dbohdan/classless-css/blob/master/screenshot-page.html and copy all the content from the main tag, as belowShow more…
$ rails g controller pages html_test_1 html_test_2 html_test_3 html_test_4
create app/controllers/pages_controller.rb
route get "pages/html_test_1"
get "pages/html_test_2"
get "pages/html_test_3"
get "pages/html_test_4"
invoke erb
create app/views/pages
create app/views/pages/html_test_1.html.erb
create app/views/pages/html_test_2.html.erb
create app/views/pages/html_test_3.html.erb
create app/views/pages/html_test_4.html.erb
invoke helper
create app/helpers/pages_helper.rb
Start the Rails Server and See Ugly Pure HTML?
Show more…
root "pages#html_test_1"
Open the app/views/layouts/application.html.erb Page Again to Include Classless CSS Styles via CDN
Show more…
$ rails -v
Rails 8.0.0
$ time rails new classless-css --asset-pipeline propshaft --skip-test
...
real 0m47.500s
user 0m33.052s
sys 0m4.249s
$ cd classless-css && code .
Now yes, HTML with Style?
After saving the above stylesheets and
Dark Mode
Some styles have the option for dark mode. To confirm, change your computer's theme in the personalization options
Next Steps
- Organize the styles according to your preference;
- If you want to spend a little more time on the frontend, check out the customization options for your favorite style;
- Dynamically update changes made to the project in the browser using Rails Live Reload;
- Use styling from project CSS files, without using CDN;
- Replicate the capability of classless CSS framework with Tailwind;
References
- Test
The above is the detailed content of Ruby on Rails - Frontend Rápido com Frameworks CSS Classless ou Classlight. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











I see Google Fonts rolled out a new design (Tweet). Compared to the last big redesign, this feels much more iterative. I can barely tell the difference

Have you ever needed a countdown timer on a project? For something like that, it might be natural to reach for a plugin, but it’s actually a lot more

Everything you ever wanted to know about data attributes in HTML, CSS, and JavaScript.

Tartan is a patterned cloth that’s typically associated with Scotland, particularly their fashionable kilts. On tartanify.com, we gathered over 5,000 tartan

At the start of a new project, Sass compilation happens in the blink of an eye. This feels great, especially when it’s paired with Browsersync, which reloads

The inline-template directive allows us to build rich Vue components as a progressive enhancement over existing WordPress markup.

PHP templating often gets a bad rap for facilitating subpar code — but that doesn't have to be the case. Let’s look at how PHP projects can enforce a basic

We are always looking to make the web more accessible. Color contrast is just math, so Sass can help cover edge cases that designers might have missed.
