【问题标题】:rails config.assets.precompile for specific sub folderrails config.assets.precompile 用于特定子文件夹
【发布时间】:2012-10-21 19:18:34
【问题描述】:

我在 app/assets/stylesheets/external/calendars 中有一些非常重的外部样式表 我不想将样式表包含在 application.css 中,因为它们不经常使用

但我希望它们预编译。

我如何使用 config.assets.precompile o 选择性地预编译此文件夹内的所有样式表?

【问题讨论】:

    标签: ruby-on-rails asset-pipeline


    【解决方案1】:

    你可以这样写:

    config.assets.precompile += ['directory1/*', 'directory2/*', 'file.js']
    

    或者使用如下更简洁的语法:

    config.assets.precompile += %w( directory1/* directory2/* file.js )
    

    【讨论】:

      【解决方案2】:

      Asset Pipeline Rails Guide 的第 4.1 节对此进行了介绍

      config.assets.precompile += ["*external/calendars*"]
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-09-08
        • 2014-12-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多