Ejemplo n.º 1
0
 /**
  * @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);
         }
     }
 }
Ejemplo 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);
 }
Ejemplo n.º 3
0
 /**
  * @return TwigThemeConfig
  */
 protected function getThemeConfig()
 {
     $themePath = TwigThemeConfig::getThemePath(env('THEME'));
     $themeConfig = TwigThemeConfig::loadConfig($themePath);
     return $themeConfig;
 }
Ejemplo 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;
Ejemplo n.º 5
0
<?php

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

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

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