[TYPO3-core] RFC #14247: Add a compressor/concatenator for CSS and JS

Jigal van Hemert jigal at xs4all.nl
Thu Apr 29 10:16:20 CEST 2010


Steffen Gebert wrote:

(whitespaces formatted below)

protected·function·processCssFile($filename)·{
(...)
//·remove·comments 

$contents·=·preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!',·'',·$contents); 


According to [1] CSS comments simply start with /* and end with */. 
Anything in between (also line breaks) is comment; comments can not be 
nested, so:
#/\*.*?\*/#s
will be enough to match these.

(...)
	//·remove·tabs,·spaces,·newlines,·etc 

$contents·=·str_replace(array("\r\n",·"\r",·"\n",·"\t",·'··',·'····',·'····'),·'',·$contents); 


I think the "\r\n" plus separete "\r" and "\n" are not necessary.
Why is there four spaces twice?

protected·function·concatenateCss(array·&$cssFiles,·t3lib_PageRenderer·&$ref)·{ 

(...)
$concatenatedOptions·=·array( 

     'rel'········=>·'stylesheet', 

     'media'······=>·'all', 

     'title'······=>·'Merged·TYPO3·Backend·Stylesheets', 

     'compress'···=>·TRUE, 

);

Are you sure that the skin CSS's will only be for media="all" ?? 
 


[1] http://www.w3.org/TR/CSS2/syndata.html#comments
-- 
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh


More information about the TYPO3-team-core mailing list