/**
  * @return \Generator
  */
 private function getPathMacros()
 {
     foreach (array_reverse($this->themeConfig->getTwigTemplatePaths()) as $path) {
         $pathMacros = glob($path . '/macros/*');
         foreach ($pathMacros as $pathMacro) {
             $name = basename($pathMacro, '.twig');
             $filename = basename($pathMacro);
             (yield $name => 'macros/' . $filename);
         }
     }
 }
Esempio n. 2
0
 /**
  * @param string $rootScssDirectory
  * @param TwigThemeConfig $themeConfig
  * @param string | null $formatter
  * @param string | null $cacheDir
  */
 public function __construct($rootScssDirectory, TwigThemeConfig $themeConfig, $formatter = 'compressed', $cacheDir = null)
 {
     $scssImportPaths = $themeConfig->getScssImportPaths();
     $scssCompiler = new Compiler();
     $scssCompiler->setImportPaths($scssImportPaths);
     $this->salt = $formatter . $rootScssDirectory . json_encode($scssImportPaths);
     switch ($formatter) {
         case 'expanded':
             $scssCompiler->setFormatter(\Leafo\ScssPhp\Formatter\Expanded::class);
             break;
         case 'compact':
             $scssCompiler->setFormatter(\Leafo\ScssPhp\Formatter\Compact::class);
             break;
         case 'compressed':
             $scssCompiler->setFormatter(\Leafo\ScssPhp\Formatter\Compressed::class);
             break;
     }
     $this->server = new Server($rootScssDirectory, $cacheDir, $scssCompiler);
     $this->server->showErrorsAsCSS(true);
 }
Esempio n. 3
0
 /**
  * @return TwigThemeConfig
  */
 protected function getThemeConfig()
 {
     $themePath = TwigThemeConfig::getThemePath(env('THEME'));
     $themeConfig = TwigThemeConfig::loadConfig($themePath);
     return $themeConfig;
 }
Esempio n. 4
0
<?php

use inklabs\KommerceTemplates\Lib\TwigThemeConfig;
$config = new TwigThemeConfig('Bootstrap', 'Deprecated Bootstrap theme', __DIR__, TwigThemeConfig::getBaseThemePath());
$config->addScssImportPath(realpath(__DIR__ . '/../../../../../vendor') . '/twbs/bootstrap-sass/assets/stylesheets');
return $config;
Esempio n. 5
0
<?php

use inklabs\KommerceTemplates\Lib\TwigThemeConfig;
return new TwigThemeConfig('Cardinal', 'The default theme for 2016', __DIR__, TwigThemeConfig::getThemePath('bootstrap'));
Esempio n. 6
0
<?php

use inklabs\KommerceTemplates\Lib\TwigThemeConfig;
return new TwigThemeConfig('Vintage', 'Minimal theme extending from Cardinal', __DIR__, TwigThemeConfig::getThemePath('cardinal'));
Esempio n. 7
0
<?php

use inklabs\KommerceTemplates\Lib\TwigThemeConfig;
return new TwigThemeConfig('Foundation', 'Deprecated Foundation theme', __DIR__, TwigThemeConfig::getBaseThemePath());