Пример #1
0
 public function compress($html)
 {
     if (!$this->twig->isDebug() || $this->forceCompression) {
         return $this->parser->compress($html);
     }
     return $html;
 }
 /**
  * @param Parser $parser
  * @param SourceSetEvent $event
  */
 protected function compress(Parser $parser, SourceSetEvent $event)
 {
     foreach ($event->allSources() as $source) {
         $ext = explode('.', $source->filename());
         $ext = $ext[count($ext) - 1];
         if (in_array($ext, ['html', 'md', 'markdown'])) {
             $source->setFormattedContent($parser->compress($source->formattedContent()));
         }
     }
 }
 /**
  * Run the value through the compressor.
  *
  * @param string $content
  * @return string
  */
 public function compress($content)
 {
     return $this->parser->compress($content);
 }