Skip to content

Instantly share code, notes, and snippets.

@edgahan
Created October 17, 2013 11:05
Show Gist options
  • Save edgahan/7023047 to your computer and use it in GitHub Desktop.
Save edgahan/7023047 to your computer and use it in GitHub Desktop.
Allows angular templates to reload
class Sprockets::DirectiveProcessor
# This is basically copied from https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/directive_processor.rb#L289
def process_depend_on_tree_directive(path = ".")
if relative?(path)
root = pathname.dirname.join(path).expand_path
unless (stats = stat(root)) && stats.directory?
raise ArgumentError, "depend_on_tree argument must be a directory"
end
context.depend_on(root)
each_entry(root) do |pathname|
context.depend_on(pathname)
end
else
# The path must be relative and start with a `./`.
raise ArgumentError, "depend_on_tree argument must be a relative path"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment