Exemplo n.º 1
0
 protected function writeCompiledFiles()
 {
     if ($this->verbosity >= self::VERBOSITY_MESSAGES) {
         $this->display(PHP_EOL . 'Writing compiled files:' . PHP_EOL);
     }
     $compiler = new Concentrate_CompilerLess();
     $fileInfo = $this->concentrator->getFileInfo();
     foreach ($fileInfo as $file => $info) {
         $fromFilename = $this->webroot . DIRECTORY_SEPARATOR . $file;
         // if source file does not exist, skip it
         if (!file_exists($fromFilename)) {
             continue;
         }
         // only compile LESS
         $type = pathinfo($fromFilename, PATHINFO_EXTENSION);
         if ($type !== 'less') {
             continue;
         }
         $toFilename = $this->webroot . DIRECTORY_SEPARATOR . 'compiled' . DIRECTORY_SEPARATOR . $file;
         if ($this->verbosity >= self::VERBOSITY_DETAILS) {
             $this->display(' * ' . $file . PHP_EOL);
         }
         $filter = new Concentrate_Filter_CSSMover($file, 'compiled/' . $file);
         $this->writeCompiledFile($compiler, $filter, $fromFilename, $toFilename, $type);
     }
     if ($this->combine) {
         $combinesInfo = $this->concentrator->getCombinesInfo();
         foreach ($combinesInfo as $combine => $info) {
             $fromFilename = $this->webroot . DIRECTORY_SEPARATOR . $combine;
             // if source file does not exist, skip it
             if (!file_exists($fromFilename)) {
                 continue;
             }
             // only compile LESS
             $type = pathinfo($fromFilename, PATHINFO_EXTENSION);
             if ($type !== 'less') {
                 continue;
             }
             $toFilename = $this->webroot . DIRECTORY_SEPARATOR . 'compiled' . DIRECTORY_SEPARATOR . $combine;
             if ($this->verbosity >= self::VERBOSITY_DETAILS) {
                 $this->display(' * ' . $combine . PHP_EOL);
             }
             $filter = new Concentrate_Filter_CSSMover($combine, 'compiled/' . $combine);
             $this->writeCompiledFile($compiler, $filter, $fromFilename, $toFilename, $type);
         }
     }
 }