View source
<?php
require_once 'functions/colors.inc';
require_once 'functions/constants.inc';
require_once 'functions/cross_browser_support.inc';
require_once 'functions/display.inc';
require_once 'functions/enumerate.inc';
require_once 'functions/font_files.inc';
require_once 'functions/gradient_support.inc';
require_once 'functions/image_size.inc';
require_once 'functions/inline_image.inc';
require_once 'functions/lists.inc';
require_once 'functions/selectors.inc';
require_once 'functions/sprites.inc';
require_once 'functions/trig.inc';
require_once 'functions/urls.inc';
function sassy_compass_sassy_resolve_path_compass($filename, $syntax = 'scss') {
$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;
}
function sassy_compass_sassy_functions() {
$functions = 'adjust-lightness scale-lightness adjust-saturation scale-saturation ie-hex-str scale-color-value ';
$functions .= 'is-position is-position-list opposite-position ';
$functions .= '-webkit -moz -o -ms -svg -pie -css2 owg prefixed prefix ';
$functions .= 'elements-of-type ';
$functions .= 'enumerate ';
$functions .= 'font-files ';
$functions .= 'image-width image-height ';
$functions .= 'inline-image inline-font-files ';
$functions .= 'blank compact -compass-nth -compass-list -compass-list -compass-space-list -compass-list-size -compass-slice first-value-of ';
$functions .= 'nest append-selector headers ';
$functions .= 'pi sin cos tan ';
$functions .= 'stylesheet-url font-url image-url';
$output = array();
$functions = explode(' ', $functions);
foreach ($functions as $function) {
$function = preg_replace('/[^a-z0-9_]/', '_', $function);
$output[$function] = array(
'name' => $function,
'callback' => 'sassy_compass__' . $function,
);
}
return $output;
}
function sassy_compass__if($condition, $if_true, $if_false) {
if ($condition) {
return new SassString($if_true);
}
return new SassString('"' . $if_false . '"');
}
function sassy_compass__resolve_path($file) {
if ($file[0] == '/') {
return $file;
}
if (!($path = realpath($file))) {
$path = SassScriptFunction::$context->node->token->filename;
$path = substr($path, 0, strrpos($path, '/')) . '/';
$path = $path . $file;
print $path;
$last = '';
while ($path != $last) {
$last = $path;
$path = preg_replace('`(^|/)(?!\\.\\./)([^/]+)/\\.\\./`', '$1', $path);
}
$path = realpath($path);
}
print "{$path}<br/>";
if ($path) {
return $path;
}
return false;
}