private function getHack(AssetInterface $asset) {
static $format = <<<'EOF'
module Sprockets
class Preprocessor
protected
def pathname_for_relative_require_from(source_line)
Sprockets::Pathname.new(@environment, File.join(%s, location_from(source_line)))
end
end
end
EOF;
$root = $asset
->getSourceRoot();
$path = $asset
->getSourcePath();
if ($root && $path) {
return sprintf($format, var_export(dirname($root . '/' . $path), true));
}
}