aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind2015-10-05 17:37:25 +0200
committerMaZderMind2015-10-05 17:37:25 +0200
commitd0e4536fafdeae749cf0f6e4934817a2a7adcefd (patch)
treebc6ac676426809345160348212705cd407cf390a
parentd9d8d4a497d49de90845438fb4e38db15171573e (diff)
use local-file cache
-rw-r--r--index.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/index.php b/index.php
index 61b250a..2a90d71 100644
--- a/index.php
+++ b/index.php
@@ -68,13 +68,19 @@ try {
else if($route == 'assets/css/main.css')
{
- $parser = new Less_Parser([
+ $dir = forceslash(sys_get_temp_dir());
+
+ $css_file = Less_Cache::Get([
+ 'assets/css/main.less' => forceslash(baseurl()).'assets/css/',
+ ], [
'sourceMap' => true,
'compress' => true,
'relativeUrls' => true,
+
+ 'cache_dir' => $dir,
]);
- $parser->parseFile('assets/css/main.less', forceslash(baseurl()).'assets/css/');
- $css = $parser->getCss();
+
+ $css = file_get_contents($dir.$css_file);
header('Content-Type: text/css');
header('Content-Length: '.strlen($css));
print($css);