问题
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