-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsass.php
34 lines (28 loc) · 779 Bytes
/
sass.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
header('Content-type: text/css');
require_once './try/phpsass/SassParser.php';
function warn($text, $context) {
print "/** WARN: $text, on line {$context->node->token->line} of {$context->node->token->filename} **/\n";
}
function debug($text, $context) {
print "/** DEBUG: $text, on line {$context->node->token->line} of {$context->node->token->filename} **/\n";
}
$file = '.' . $_SERVER['PATH_INFO'];
$syntax = substr($file, -4, 4);
$options = array(
'style' => 'expanded',
'cache' => FALSE,
'syntax' => $syntax,
'debug' => FALSE,
'callbacks' => array(
'warn' => 'warn',
'debug' => 'debug'
),
);
// Execute the compiler.
$parser = new SassParser($options);
try {
print "\n\n" . $parser->toCss($file);
} catch (Exception $e) {
print $e->getMessage();
}