Pagina 1 din 1

preg_replace() compress css code in pagine

Scris: Joi Ian 19, 2017 4:40 pm
de XDYNX
Am un plugin care adaugi niste regex cod, ceva de genul si iti replace in site....


A mapping of PHP regular expressions to replacement values which are executed on all blog HTML after WordPress finishes emitting the entire page. The pattern and replacement behavior is in the manner of preg_replace().

The following example removes all HTML comments in the first pattern, and causes a favicon (with any filename extension) to be loaded from another domain in the second pattern:
#<!--.*?-->#s =>
#\bsrc="/(favicon\..*)"# => src="http://mycdn.somewhere.com/$1"



Eu am incercat
#<!--.*?-->#s =>
/^[ \t]*[\r\n]+/m =>

Asta #<!--.*?-->#s => elimina comentarile
Si asta /^[ \t]*[\r\n]+/m => scoate linile goale

Acum vreau sa comprime codul css din pagina ? puteti sa ma ajutati

Re: preg_replace() compress css code in pagine

Scris: Mie Ian 25, 2017 11:10 pm
de vectorialpx
Comprimarea nu o faci tu, o face serverul - banuiesc ca te referi la gzip
http://stackoverflow.com/questions/9558 ... ile-in-php

Re: preg_replace() compress css code in pagine

Scris: Joi Ian 26, 2017 11:36 am
de nevvermind
Cred ca vrea "minified".