Пример #1
0
 /**
  * Sets the imported file
  *
  * @param string $pathAbsolute The absolute path
  * @param ILess_ImportedFile $file The imported file
  * @param string $path The original path to import
  * @param ILess_FileInfo $currentFileInfo
  * @return ILess_Importer
  */
 public function setImportedFile($pathAbsolute, ILess_ImportedFile $file, $path, ILess_FileInfo $currentFileInfo)
 {
     $this->importedFiles[$pathAbsolute] = array($file, $path, $currentFileInfo);
     // save for source map generation
     $this->env->setFileContent($pathAbsolute, $file->getContent());
     return $this;
 }
Пример #2
0
 /**
  * Parses a string
  *
  * @param string $string The string to parse
  * @param string $filename The filename for reference (will be visible in the source map)
  * @return ILess_Parser_Core
  */
 public function parseString($string, $filename = '__string_to_parse__')
 {
     $string = ILess_Util::normalizeString((string) $string);
     // we need unique key
     $key = sprintf('%s[__%s__]', $filename, md5($string));
     // create a dummy information, since we are not parsing a real file,
     // but a string comming from outside
     $this->env->setCurrentFile($filename);
     $importedFile = new ILess_ImportedFile($key, $string, time());
     // save information, so the exceptions can handle errors in the string
     // and source map is generated for the string
     $this->env->currentFileInfo->importedFile = $importedFile;
     $this->importer->setImportedFile($key, $importedFile, $key, $this->env->currentFileInfo);
     if ($this->env->sourceMap) {
         $this->env->setFileContent($key, $string);
     }
     $this->rules = array_merge($this->rules, $this->parse($string));
     return $this;
 }