我尝试将我的应用分成两个版本。 一个是使用CDN,另一个是使用资产脚本和css。
对于CDN,无论如何我可以将所有CDN行拆分到其他文件并在application.haml中设置链接以使其清理。
这里是application.haml(或html)
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
= csrf_meta_tags
%link{:href => "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css", :rel => "stylesheet"}/
Optional Theme
%link{:href => "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css", :rel => "stylesheet"}/
%link{:href => "https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css", :rel => "stylesheet"}/
%link{:href => "https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/AdminLTE.css", :rel => "stylesheet"}/
%link{:href => "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css\n", :rel => "stylesheet"}/
%link{:href => "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic", :rel => "stylesheet"}/
%script{:crossorigin => "anonymous", :integrity => "sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=", :src => "https://code.jquery.com/jquery-3.2.1.min.js"}
%script{:crossorigin => "anonymous", :integrity => "sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=", :src => "https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"}
%script{:src => "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.13.0/popper.min.js"}
%script{:crossorigin => "anonymous", :integrity => "sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa", :src => "//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"}
%script{:src => "https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.js"}
%script{:src => "https://cdnjs.cloudflare.com/ajax/libs/jQuery-slimScroll/1.3.8/jquery.slimscroll.js"}
%script{:src => "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.3/moment.min.js"}
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_include_tag "application", 'data-turbolinks-track': 'reload'
%body.hold-transition.skin-yellow.sidebar-mini
.wrapper
= render "layouts/navigation/header"
= render "layouts/navigation/sidebar"
.content-wrapper
= yield
= render 'layouts/navigation/footer'
答案 0 :(得分:0)
您可以为使用单独资产的其他版本创建单独的控制器。
创建versionb_controller.rb
并更新routes.rb
添加文件夹/views/versionb
添加您的观看次数/views/versionb/index.html.erb
最后,在布局下添加其他版本的布局并保存为/layouts/versionb.html.erb