ruby 适用于Comfy的CSS和Javascript助手

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby 适用于Comfy的CSS和Javascript助手相关的知识,希望对你有一定的参考价值。

class Comfy::Cms::File < ActiveRecord::Base
  
  ...
  
  # Just like app/models/comfy/cms/layout.rb#cache_buster
  def cache_buster
    updated_at.to_i
  end
end
module Comfy::CmsHelper
  # To include CSS files from the library use this helper method in your Rails view.
  # It works just like the *stylesheet_link_tag* helper method.
  #
  #   comfy_stylesheet_link_tag 'styles.css'
  #
  def comfy_stylesheet_link_tag(site=@cms_site, filename)
    # Get the file so we can add the cache buster to the link.
    file = site.files.find_by_file_file_name!(filename)
    stylesheet_link_tag comfy_cms_render_css_path(site.id, filename.parameterize, file.cache_buster)
  end

  # To include Javascript files from the library use this helper method in your Rails view.
  # It works just like the *javascript_include_tag* helper method.
  #
  #   comfy_javascript_include_tag 'script.js'
  #
  def comfy_javascript_include_tag(site=@cms_site, filename)
    # Get the file so we can add the cache buster to the link.
    file = site.files.find_by_file_file_name!(filename)
    javascript_include_tag comfy_cms_render_js_path(site.id, filename.parameterize, file.cache_buster)
  end
end

以上是关于ruby 适用于Comfy的CSS和Javascript助手的主要内容,如果未能解决你的问题,请参考以下文章

适用于Windows,Ruby,Cucumber和Capybara的无忧启动指南

ruby 适用于Ruby的FuzzBuzz解决方案

适用于 Ruby 的 PayPal REST SDK - 非全局配置

ruby 适用于AWS的SD

适用于 Python 或 Ruby 的 Amazon Book API? [复制]

使用适用于 Ruby 的 AWS 开发工具包发布到 SNS 主题时指定区域