public function serve($resetSalt = false) { if ($resetSalt) { $this->salt = time(); } $this->server->serve($this->salt); }
public function testCheckedCachedCompile() { $server = new Server(__DIR__ . '/inputs/'); $css = $server->checkedCachedCompile(__DIR__ . '/inputs/import.scss', '/tmp/scss.css'); $this->assertFileExists('/tmp/scss.css'); $this->assertFileExists('/tmp/scss.css.meta'); $this->assertEquals($css, file_get_contents('/tmp/scss.css')); $this->assertNotNull(unserialize(file_get_contents('/tmp/scss.css.meta'))); }
/** * Handles requests to scss files */ function scss($args) { $server = new Server($this->theme_location . '/static/scss'); $file_location = $this->theme_location . '/static/scss/' . implode('/', $args); $cache_location = ROOT_DIR . '/cache/scss/' . basename($file_location) . '_cache'; if (!is_dir(dirname($cache_location))) { mkdir(dirname($cache_location), 0777, true); } header("Content-Type: text/css"); header("X-Content-Type-Options: nosniff"); header("Access-Control-Allow-Origin:*"); header('Cache-Control:public, max-age=30672000'); echo $server->checkedCachedCompile($file_location, $cache_location); die; }