/** * Smart caching and retrieval of a tree of @import SCSS stylesheets * * @since 1.5 * @param WPScssStylesheet $stylesheet * @param bool $force */ public function cacheStylesheet(WPScssStylesheet $stylesheet, $force = false) { $cache_name = 'wp_scss_compiled_' . md5($stylesheet->getSourcePath()); $compiled_cache = get_transient($cache_name); if (!$force && !file_exists($stylesheet->getTargetPath())) { $force = true; } $compiled_cache = $this->cachedCompile($compiled_cache ? $compiled_cache : $stylesheet->getSourcePath(), $force); // saving compiled stuff if (isset($compiled_cache['compiled']) && $compiled_cache['compiled']) { $stylesheet->setSourceTimestamp($compiled_cache['updated']); $this->saveStylesheet($stylesheet, $compiled_cache['compiled']); $compiled_cache['compiled'] = NULL; set_transient($cache_name, $compiled_cache); } }