Is there a way to add an exception to the require_tree in a manifest file?

假装没事ソ 提交于 2019-12-18 14:14:37

问题


Is there a way you can include all files in a directory except one, or all directories except one? So something like:

require_tree . :except 'this_one'

Just wondering and can't figure out where the documentation is on the "require_tree" method in the manifest file.


回答1:


Depending on the version of your environment the following may be possible:

//= require_tree "." exclude: "file1", "file2"

See this SO thread: Rails 3.1 Sprockets require directives - is there a way to exclude particular files?. Never tried it myself, though.




回答2:


Instead of

require_tree . :except 'this_one'

write

require_tree "."

stub "this_one"



来源:https://stackoverflow.com/questions/15138559/is-there-a-way-to-add-an-exception-to-the-require-tree-in-a-manifest-file

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