Rails:Tidy Stylesheets
-
08-07-2019 - |
题
任何人都知道如何采取这个教程并使用绝对网址生成样式表标记?
解决方案
想出来。
在application_helper.rb中的内容:
def get_stylesheets
stylesheets = [] unless stylesheets
["http://www.example.com/stylesheets/#{controller.controller_path}/#{controller.action_name}"].each do |ss|
stylesheets << ss if File.exists? "#{Dir.pwd}/public/stylesheets/#{ss}.css"
end
end
按宣传方式工作。太好了!
我一直想要这么做 - 现在感谢Rails我能做到!哇噢!
不隶属于 StackOverflow