You are here

function sassy_compass_sassy_resolve_path_compass in Sassy 7.2

Same name and namespace in other branches
  1. 7.3 sassy_compass/sassy_compass.module \sassy_compass_sassy_resolve_path_compass()

Implementation of hook_sassy_resolve_path_NAMESPACE().

File

extensions/compass/sassy_compass.module, line 22

Code

function sassy_compass_sassy_resolve_path_compass($filename, $syntax = 'scss') {

  // Check for compass installed as a Library, if not use ours.
  // The latest Compass build can be found at https://github.com/chriseppstein/compass
  $path = libraries_get_path('compass') . '/core';
  if (!file_exists($path)) {
    $path = drupal_get_path('module', 'sassy_compass');
  }
  if ($filename == '*') {
    $filename = 'compass';
  }
  $filename = str_replace(array(
    '.scss',
    '.sass',
  ), '', $filename);
  $split = explode('/', $filename);
  if ($split[0] != 'compass' && $split[0] != 'lemonade') {
    array_unshift($split, 'compass');
  }
  $last = array_pop($split) . '.scss';
  if (substr($last, 0, 1) != '_') {
    $last = '_' . $last;
  }
  array_unshift($split, 'stylesheets');
  array_unshift($split, $path);
  $filename = str_replace('/_', '/', implode('/', $split)) . '/' . $last;
  return $filename;
}