[Phpmyadmin-devel] Duplicate code in CSS themes

Rouslan Placella rouslan at placella.com
Sat May 19 00:21:00 CEST 2012


On 14/05/12 13:42, Michal Čihař wrote:
> Hi
>
> Dne Mon, 14 May 2012 13:11:16 +0100
> Rouslan Placella<rouslan at placella.com>  napsal(a):
>
>> 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.
>
> Well I had some mail backlog so I managed to read your mail just after
> sending mine :-).
>
>> 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.
>
> I think this is really good approach.

I've implemented my idea in pull request #67 [0].

Anyway, there is still room for improvement in splitting the new common 
CSS file as I've only factored out the few obvious parts that I found.

If, in future, anyone wants to factor out a part of the common CSS file, 
it will necessary to add the name of the new CSS file (without any 
extensions) to the $css_files array in the Theme class so that it can be 
picked up and proceesed by PMA.

Bye,
Rouslan

[0]: https://github.com/phpmyadmin/phpmyadmin/pull/67




More information about the Developers mailing list