You are here

function hook_sass_resolve_path_theme in Sassy 7.2

Example implementation of a "theme" namespace which can handle the following: theme/path/to/file - paths within the currently enabled theme. theme/THEMENAME/path/to/file - paths within the named theme.

File

./sassy.api.php, line 56
Hooks provided by the Sassy module.

Code

function hook_sass_resolve_path_theme($filename, $syntax) {
  $parts = explode('/', $filename, 2);
  if (!($path = drupal_get_path('theme', array_shift($parts)))) {
    $path = drupal_get_path('theme', $GLOBALS['theme_key']);
  }
  array_unshift($parts, $path);
  $file = implode('/', $parts);
  foreach (array(
    '',
    '.scss',
    '.sass',
  ) as $ext) {
    if (file_exists($file . $ext)) {
      return $file . $ext;
    }
  }
  return FALSE;
}