Ruby-on-rails 在资产管道中需要树
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13105387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Require tree in asset pipeline
提问by Verdi Erel Ergün
I have a folder in my asset pipeline called typefaces. It works without any additions to application.rb.
我的资产管道中有一个名为字体的文件夹。它无需任何添加即可工作application.rb。
In the directory I have different typeface types, like .eof, .ttf, etc in folders, like this
在目录中,我有不同的字体类型,例如文件夹中的 .eof、.ttf 等,如下所示
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?
我如何让资产管道超越资产/字体进入资产/字体/eof、资产/字体/ttf 等?
回答by Kleber S.
In your app/assets/javascripts/application.jsfile, try putting:
在您的app/assets/javascripts/application.js文件中,尝试放置:
//= require_tree ../Typefaces
//= require_tree ../Typefaces
See more: http://guides.rubyonrails.org/asset_pipeline.html
查看更多:http: //guides.rubyonrails.org/asset_pipeline.html
Let me know if that works.
让我知道这是否有效。
回答by Taimoor Changaiz
In application.css
在 application.css 中
/*
*= require_self
*= require_tree ./folder_name/
*/
Detailed Reference: http://railscasts.com/episodes/279-understanding-the-asset-pipeline?view=asciicast
详细参考:http: //railscasts.com/episodes/279-understanding-the-asset-pipeline?view= asciicast

