/** * @see CssUtils::filterImports() */ protected function filterImports($content, $callback, $limit = -1, &$count = 0, $includeUrl = true) { return CssUtils::filterImports($content, $callback, $limit, $count, $includeUrl); }
/** * Get advanced file info only for compiling collections * @return void */ public function fileAdvancedInfo() { $this->path = public_path() . '/' . app('config')->get('assets::public_dir') . '/' . $this->name; if (app('files')->exists($this->path)) { $this->fileName = basename($this->path); $this->extension = app('files')->extension($this->path); $this->modified = (int) @filemtime($this->path); $this->dirty = false; // Check for import statements $this->contents = $this->contents(); // Assets directory $assetDir = pathinfo($this->name, PATHINFO_DIRNAME); $item =& $this; // Prepare callback for imports $callback = function ($matches) use($assetDir, $item) { if (isset($matches[2]) and $import = $matches[2]) { $isRemote = (strpos($import, 'http://') === 0 or strpos($import, 'https://') === 0 or strpos($import, '//') === 0); if (!$isRemote) { $importPath = public_path() . '/' . app('config')->get('assets::public_path') . '/' . $assetDir . '/' . str_replace("\"", "", $import); $importModified = (int) @filemtime($importPath); // Check modified time if ($importModified > $item->modified) { $item->modified = $importModified; } // Get imported contents return app('files')->get($importPath); } elseif (isset($matches[0])) { return $matches[0]; } } }; // Test if ($this->type == 'css') { $this->contents = CssUtils::filterImports($this->contents, $callback); } // Update group modified time if ($this->modified > $this->collection->modified) { $this->collection->setModified($this->modified); } } }