Require tree in asset pipeline

痞子三分冷 提交于 2019-12-04 22:15:12

问题


I have a folder in my asset pipeline called typefaces. It works without any additions to application.rb.

In the directory I have different typeface types, like .eof, .ttf, etc in folders, like this

Assets
    Typefaces
        Eof
           ...files
        Ttf
           ...files

Unless the typefaces are in Assets/typefaces they don't become part of asset pipeline. Asset pipeline doesn't go into the subdirectories.

How would I have asset pipeline look beyond assets/typefaces into assets/typefaces/eof, assets/typefaces/ttf etc?


回答1:


In your app/assets/javascripts/application.js file, try putting:

//= require_tree ../Typefaces

See more: http://guides.rubyonrails.org/asset_pipeline.html

Let me know if that works.




回答2:


In application.css

/*
*= require_self
*= require_tree ./folder_name/

*/

Detailed Reference: http://railscasts.com/episodes/279-understanding-the-asset-pipeline?view=asciicast



来源:https://stackoverflow.com/questions/13105387/require-tree-in-asset-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!