【问题标题】:Rails: Tidy StylesheetsRails:整洁的样式表
【发布时间】:2008-11-18 22:02:35
【问题描述】:

有谁知道如何采用this 教程中提到的绝妙方法并使用绝对 URLs 生成样式表标签?

【问题讨论】:

    标签: ruby-on-rails stylesheet


    【解决方案1】:

    想通了。

    在 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,我可以做到!哇哦!

    【讨论】:

      猜你喜欢
      • 2013-09-07
      • 2021-08-08
      • 2014-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多