-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsource_map.php
40 lines (32 loc) · 855 Bytes
/
source_map.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
35
36
37
38
39
40
<?php
use ILess\Exception\Exception;
use ILess\Parser;
require_once '_bootstrap.php';
try {
$cacheDir = dirname(__FILE__) . '/cache';
// create the parser
$parser = new Parser([
'compress' => false,
'source_map' => true, // enable source map
'source_map_options' => [
'source_contents' => true,
],
]
);
// parse file
$parser->parseFile(__DIR__ . '/less/test.less');
// parse additional string
$parser->parseString('
#header {
background: black;
}');
$cssContent = $parser->getCSS();
file_put_contents($cacheDir . '/screen.css', $cssContent);
$css = 'cache/screen.css';
} catch (Exception $e) {
@header('HTTP/1.0 500 Internal Server Error');
echo $e;
exit;
}
$example = 'source map output';
include '_page.php';