Exemplo n.º 1
0
 /**
  * Update all CSS files in the theme.
  *
  * @param array $configurations
  * @return array List of CSS warnings.
  */
 public function updateCss(array $configurations = null)
 {
     $gantry = static::gantry();
     $compiler = $this->compiler();
     if (is_null($configurations)) {
         /** @var UniformResourceLocator $locator */
         $locator = $gantry['locator'];
         $path = $locator->findResource($compiler->getTarget(), true, true);
         // Make sure that all the CSS files get deleted.
         if (is_dir($path)) {
             Folder::delete($path, false);
         }
         $configurations = $gantry['configurations'];
     }
     // Make sure that PHP has the latest data of the files.
     clearstatcache();
     $warnings = [];
     foreach ($configurations as $configuration => $title) {
         $config = ConfigServiceProvider::load($gantry, $configuration);
         $compiler->reset()->setConfiguration($configuration)->setVariables($config->flatten('styles', '-'));
         $results = $compiler->compileAll()->getWarnings();
         if ($results) {
             $warnings[$configuration] = $results;
         }
     }
     return $warnings;
 }
Exemplo n.º 2
0
 /**
  * Update all CSS files in the theme.
  */
 public function updateCss()
 {
     $gantry = static::gantry();
     $compiler = $this->compiler();
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $path = $locator->findResource($compiler->getTarget(), true, true);
     // Make sure that all the CSS files get deleted.
     if (is_dir($path)) {
         Folder::delete($path, false);
     }
     /** @var Configurations $configurations */
     $configurations = $gantry['configurations'];
     foreach ($configurations as $configuration => $title) {
         $config = ConfigServiceProvider::load($gantry, $configuration);
         $compiler->reset()->setConfiguration($configuration)->setVariables($config->flatten('styles', '-'));
         $compiler->compileAll();
     }
 }