Projekt

Allgemein

Profil

GX-Bug #54155 » refs_#54155_1.patch

Mirko Janssen, 13.02.2018 10:14

Unterschiede anzeigen:

src/templates/Honeygrid/gm_dynamic.css.php (revision 652fbab6b21d10b98ee5ed53b43dc501c098dd55)
1 1
<?php
2 2
/* --------------------------------------------------------------
3
   gm_dynamic.css.php 2018-02-12
3
   gm_dynamic.css.php 2018-02-13
4 4
   Gambio GmbH
5 5
   http://www.gambio.de
6 6
   Copyright (c) 2018 Gambio GmbH
......
76 76
	$suffix = '';
77 77
}
78 78

  
79
$additionalCssFiles = array();
79
$additionalCssFiles  = array();
80
$additionalScssPaths = array();
80 81

  
81 82
if(file_exists(DIR_FS_CATALOG . 'templates/' . $currentTemplate . '/stylesheet.css'))
82 83
{
......
117 118
foreach($iterator as $file)
118 119
{
119 120
	$file = str_replace('\\', '/', $file->getPathname());
120
	if((strpos($file, '/Templates/' . $currentTemplate . '/Css/') !== false 
121
		|| strpos($file, '/Templates/All/Css/') !== false)
122
		&& substr($file, -4) === '.css')
121
	if(stripos($file, '/Templates/' . $currentTemplate . '/Css/') !== false
122
		|| stripos($file, '/Templates/All/Css/') !== false)
123 123
	{
124
		$additionalCssFiles[] = $file;
124
		if(substr($file, -4) === '.css')
125
		{
126
			$additionalCssFiles[] = $file;
127
		}
128
		elseif(substr($file, -9) === 'main.scss')
129
		{
130
			$additionalScssPaths[] = substr(substr($file, 0, strripos($file, '/')), strlen(DIR_FS_CATALOG));
131
		}
125 132
	}
126 133
}
134
$additionalScssPaths = array_unique($additionalScssPaths);
127 135

  
128 136
$cacheFile = DIR_FS_CATALOG . 'cache/' . (!array_key_exists('style_edit_cache', $_GET)  
129 137
	?  '__dynamics.css' : '__dynamics_style_edit.css');
......
383 391
	// Serve CSS
384 392
	$compiler = new scssc();
385 393
	$compiler->addImportPath($basePath);
394
	if(count($additionalScssPaths) > 0)
395
	{
396
		foreach($additionalScssPaths as $additionalScssPath)
397
		{
398
			$compiler->addImportPath($additionalScssPath);
399
		}
400
	}
386 401

  
387 402
	if($suffix === '.min')
388 403
	{
......
398 413
	try
399 414
	{
400 415
		$server->serve();
416
		if(count($additionalScssPaths) > 0)
417
		{
418
			foreach($additionalScssPaths as $additionalScssPath)
419
			{
420
				$server = new scss_server($additionalScssPath, 'cache', $compiler);
421
				$server->serve();
422
			}
423
		}
401 424
	}
402 425
	catch(\Exception $e)
403 426
	{
......
452 475
		{
453 476
			$compiler = new scssc();
454 477
			$compiler->addImportPath($basePath);
478
			if(count($additionalScssPaths) > 0)
479
			{
480
				foreach($additionalScssPaths as $additionalScssPath)
481
				{
482
					$compiler->addImportPath($additionalScssPath);
483
				}
484
			}
455 485
		
456 486
			if($suffix === '.min')
457 487
			{
......
470 500
			@file_put_contents(DIR_FS_CATALOG . $customDir . '_custom_styles.scss', '');
471 501
			
472 502
			$server->serve();
503
			if(count($additionalScssPaths) > 0)
504
			{
505
				foreach($additionalScssPaths as $additionalScssPath)
506
				{
507
					$server = new scss_server($additionalScssPath, 'cache', $compiler);
508
					$server->serve();
509
				}
510
			}
473 511
			
474 512
			$scss  = ob_get_clean();
475 513
			$scss = $errorMessage . $styleEditErrorMessage . $scss;
(1-1/2)