class Sprockets::DirectiveProcessor
def process_require_directive(path)
//= require "./bar"
path:
Relative paths work too. Use a leading `./` to denote a relative
//= require "foo"
assumes you are requiring another ".js".
Extensions are optional. If your source file is ".js", it
//= require "foo.js"
`require` works with files in the environment path:
and ensures its only loaded once before the source file.
It provides a way to declare a dependency on a file in your path
The `require` directive functions similar to Ruby's own `require`.
def process_require_directive(path) if @compat if path =~ /<([^>]+)>/ path = $1 else path = "./#{path}" unless relative?(path) end end context.require_asset(path) end