[thelist] PHP-ized Style Sheets

kasimir-k kasimir.k.lists at gmail.com
Sun Mar 3 06:17:22 CST 2013


Renoir B. scribeva in 2013-03-02 15:13:
> I think that creating a CSS parser is a very good brain gymnastic.

It would be, but this is actually not a CSS parser: it just takes in 
files with a .css extension, executes any PHP found in them, and outputs 
the result.

Maybe I should give some background and reasoning behind this script. 
The aim is to bring in things like variables and functions to 
.css-files, but *not* bring in a new language. Just by dropping one 
PHP-file in the CSS-directory the developer automagically gets combined, 
minified and cached CSS-files - nothing new to learn.

> I would recommend
> 0.- PiSS is very bad. From a north American culture perspective.

Point taken into consideration. However, here in Europe "piss" is 
considered only very mildly offensive, if even that. And this is 
licensed under ICS license, so anyone wishing to use it could just 
delete any offensive words.

> 1.- have a look at the way you load your library and see if you can make it
> available through packagist and the PSR-0 php library standard.

I'll have a better look into packagist. PSR-0 doesn't seem to be 
applicable, as PiSS is just one script (and a very small one at that), 
no classes - but PSR-0 dictates *class* naming.

> 2.- did you look at other css compilers/parsers such as YUI-Compressor,
> Recess, Stylus, MoreCSS?

I did have a look - but again: this is something far more simple than 
parsers, yet providing most of benefits of e.g. LESS and Sass.

David Miller scribeva in 2013-03-02 16:11:>
 > Given that this is equivalent of doing this plus minifying
 > (Which you don't want to do on the fly per request :)...
>  AddType application/x-httpd-php .piss

Indeed, that's why the results of minification are cached, and 
re-minified only when the source files are changed. And in addition to 
executing PHP, the script also combines multiple CSS-files into one - it 
is easier to author many small CSS-files than one huge file, but it's 
better to serve only one.

Thanks for your views, appreciated,

More information about the thelist mailing list