private function SprocketsFilter::getHack

1 call to SprocketsFilter::getHack()
SprocketsFilter::filterLoad in drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Filter/SprocketsFilter.php
Hack around a bit, get the job done.

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Filter/SprocketsFilter.php, line 132

Class

SprocketsFilter
Runs assets through Sprockets.

Namespace

Assetic\Filter

Code

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));
  }
}