public function testSetFoldersFallback() { $Sass = new SassComponent(new ComponentCollection(), array('sourceFolder' => false)); $Sass->startup($this->Controller); $Sass->initialize($this->Controller); $this->assertFalse($Sass->settings['sourceFolder']); }
/** * Compile the .scss files * * @param string $inputFile * @param string $outputFile * * @return boolean */ protected function _autoCompileSass($inputFile, $outputFile) { $cacheFile = str_replace(DS, '_', str_replace(APP, null, $outputFile)); $cacheFile = $this->_cacheFolder . DS . $cacheFile; $cacheFile = substr_replace($cacheFile, 'cache', -3); $cache = file_exists($cacheFile) ? unserialize(file_get_contents($cacheFile)) : $inputFile; if (!self::$_instance instanceof SassCompiler) { self::$_instance = new SassCompiler(); self::$_instance->registerHelper('CompassUrl'); self::$_instance->registerHelper('CompassImageDimension'); self::$_instance->registerHelper('CompassConstant'); self::$_instance->registerHelper('CompassMath'); self::$_instance->registerHelper('CompassFontFiles'); self::$_instance->registerHelper('CompassInlineData'); self::$_instance->registerHelper('CompassSprite'); self::$_instance->setFormatter($this->settings['formatter']); $paths = array(); foreach ($this->_sassFolders as $folder) { foreach ($this->settings['import_paths'] as $path) { if ($fullPath = realpath($folder->path . DS . $path)) { $paths[] = $fullPath; } } } self::$_instance->setImportPaths($paths); } $newCache = self::$_instance->cachedCompile($cache, $this->settings['forceCompiling']); if (true === $this->settings['forceCompiling'] || !is_array($cache) || $newCache["updated"] > $cache["updated"]) { file_put_contents($cacheFile, serialize($newCache)); file_put_contents($outputFile, $newCache['compiled']); return true; } return false; }