$ 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>
,通过ERB标签<%=产量%> 。该标签充当集成点,包含由 Rails 动态呈现的视图内容;
显示更多...
$ 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中文网其他相关文章!