$ 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 .
顯示更多...
<!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>
顯示更多...
$ 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
在 VSCode 中開啟 config/routes.rb 文件
$ 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
使用終端,您可以透過指定控制器(使用 -c)來顯示路由,例如從控制器頁面 或您可以使用 也可以使用網址http://127.0.0.1:3000/rails/info/routes透過瀏覽器存取路線。不要忘記使用 bin/dev 啟動開發伺服器,或使用專案根目錄中的rails server 啟動標準rails 伺服器。開發伺服器「偵聽」javascript 檔案和 css 檔案中的更改,以執行必要的處理,使它們可供使用者使用。要在瀏覽器中立即對這些檔案進行更改和查看,需要安裝一個 gem,例如 Rails Livre Reload。 顯示更多...
$ 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>
造訪連結 https://github.com/dbohdan/classless-css/blob/master/screenshot-page.html 並複製主標籤中的所有內容,如下顯示更多...
$ 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
顯示更多...
root "pages#html_test_1"
顯示更多...
$ 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 .
儲存上述樣式表後
某些樣式可以選擇深色模式。若要確認,請在個人化選項中變更電腦的主題
以上是Ruby on Rails - 前端 Rápido com 框架 CSS Classless 或 Classlight的詳細內容。更多資訊請關注PHP中文網其他相關文章!