예제 #1
0
 /**
  * Lookup and extract assets from a stylesheet element
  * @param Element $element the stylesheet element
  */
 private function extractStyleSheet(Element $element)
 {
     if ($element instanceof StyleSheet) {
         $href = $element->attr('href');
         $this->addAsset('css', $href);
         $parsedUrl = parse_url($href);
         if ($this->isDeepParsing() && array_key_exists('path', $parsedUrl) && !array_key_exists('host', $parsedUrl)) {
             $file = $this->directory->getFile($parsedUrl['path']);
             if ($file->exists()) {
                 $this->loadStyleSheetAsset($file->read());
             }
         }
     }
 }
 /**
  * Lookup and extract assets from a stylesheet element
  * @param Element $element the stylesheet element
  */
 private function extractStyleSheet(Element $element)
 {
     if ($element instanceof StyleSheet) {
         $href = $element->attr('href');
         $this->addAsset('css', $href);
         $parsedUrl = parse_url($href);
         if (!is_null($this->path) && array_key_exists('path', $parsedUrl) && !array_key_exists('host', $parsedUrl)) {
             //relative
             $styleSheetPath = $this->path . DIRECTORY_SEPARATOR . $parsedUrl['path'];
             if (file_exists($styleSheetPath)) {
                 $this->loadStyleSheetAsset(file_get_contents($styleSheetPath));
             }
         }
     }
 }