【问题标题】:Assets pipeline exclude list资产管道排除列表
【发布时间】:2015-04-28 20:59:02
【问题描述】:

我正在使用 rails 编译一些静态 html 文件。

它们位于 assets/html 文件夹和子文件夹中,因此我将其添加到了我的 application.rb 中:

config.assets.paths << "#{Rails.root}/app/assets/html"
config.assets.precompile += %w( */*.html )

有没有办法定义一个排除列表?

示例:不应编译所有以“_”开头的文件(如 _test.html.erb)。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 erb


    【解决方案1】:

    config.assets.paths 可能是一个常规的 ruby​​ 数组。这意味着在编译之前,您可以对其应用拒绝之类的操作。试试这个:

    config.assets.paths.reject! { |path| path =~ /^_/i }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-21
      • 2016-06-25
      • 1970-01-01
      • 2016-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-19
      相关资源
      最近更新 更多