Slide 24
Slide 24 text
• require [path] inserts the contents of the asset source file specified by path. If the file is
required multiple times, it will appear in the bundle only once.
• include [path] works like require, but inserts the contents of the specified source file even
if it has already been included or required.
• require_directory [path] requires all source files of the same format in the directory
specified by path. Files are required in alphabetical order.
• require_tree [path] works like require_directory, but operates recursively to require all
files in all subdirectories of the directory specified by path.
• require_self tells Sprockets to insert the body of the current source file before any
subsequent require or include directives.
• depend_on [path] declares a dependency on the given path without including it in the
bundle. This is useful when you need to expire an asset’s cache in response to a change in
another file.
• stub [path] allows dependency to be excluded from the asset bundle. The path must be a
valid asset and may or may not already be part of the bundle. Once stubbed, it is
blacklisted and can’t be brought back by any other require.