[Phpmyadmin-devel] Duplicate code in CSS themes

Rouslan Placella rouslan at placella.com
Mon May 14 14:11:16 CEST 2012

On 14/05/12 12:58, Michal Čihař wrote:
> Hi all
> I think it is pretty obvious that all themes will share quite big load
> of CSS. Originally I though about extracting these bits to Theme class
> methods, but now I think it would make things even harder to maintain.
> What I feel would be better to create core CSS file, which would be
> always included and theme authors will just override/extend it.
> This way, we can make changes in core without breaking older themes too
> much - maybe some things will not look 100% intergrated, but at least
> the layout won't be broken.
> Currently original and pmahomme themes share about 2500 lines, they
> differ in 1000/500 (pmahomme/original) lines.

I mentioned a few days ago that I'm already working on this, thought I 
didn't get into details, so here's my plan.

I will merge theme_left with theme_right first (we'll only have one 
frame in 4.0). Then split the resulting file into smaller files, e.g.: 
common.css, pmd.css, gis.css, rte.css, etc...
The idea here is to make the css files more managable, right now it 
looks to me like everyone just appends new stuff at the bottom of our 
huge files creating an ever bigger mess out of them.

Then all of the resulting files will be reassembled back into a single 
file by the Theme class at run time and sent to the browser along with a 
cache header.

As far as the code duplication goes, the idea is to make all of the new, 
smaller, css files overridable. So only the default theme will include 
all the css files and if another theme is selected and it, for example, 
only has a common.css file, all the other files will be included from 
the default theme.

I think that this approach will both minimise code duplication and 
improve the maintainability of CSS files.



More information about the Developers mailing list