phpBB

Development Discussion Board

phpBB's testing ground of bleeding edge code
Advanced search

Remove duplicate css of stylesheet files

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.1/Ascreaus followed by 3.2/Arsia.

Remove duplicate css of stylesheet files

Postby Raimon » Wed Aug 25, 2010 8:33 pm

As per [RFC|Accepted] No db storage of themes and stylesheets it might also be useful to increase the size of all the stylesheet files

Currently the stylesheet contains a lot of duplicate css, what really not make any sense.

For example ;

content.css
Code: Select all
li.row:hover {
   background-color: #f6f6f6;
}


colours.css
Code: Select all
li.row:hover {
   background-color: #F6F4D0;
}


I can imagine that we can not reduce it to one file since that would be give some problems to Custom Styles, that would be something for 4.0 i think, but general it should be possible to remove those duplicate content that is not used by prosilver, like the example above.

Any thoughts about this?
User avatar
Raimon
Styles Team Leader
Styles Team Leader
 
Posts: 67
Joined: Sun Mar 19, 2006 1:21 pm

Re: Remove duplicate css of stylesheet files

Postby ameeck » Wed Aug 25, 2010 10:00 pm

I completely agree with this.

While separating the content into different files and setting dimensions and content flow in one and adding colors in another is fine, setting them at both places and rewriting them is redundant and should be removed.
Please think before you post.
User avatar
ameeck
Registered User
 
Posts: 86
Joined: Sun Nov 13, 2005 6:43 pm
Location: Prague, Czech Republic

Re: Remove duplicate css of stylesheet files

Postby rahber » Wed Aug 25, 2010 10:32 pm

+1

it would be great.

just one thing isn't it good to have all style attributes in one file?
because it may get difficult for a newbie to sort things out in different files ?
lost in area 51 :o
User avatar
rahber
Styles Team
Styles Team
 
Posts: 12
Joined: Mon Feb 02, 2009 10:08 am

Re: Remove duplicate css of stylesheet files

Postby A_Jelly_Doughnut » Wed Aug 25, 2010 10:48 pm

I'd like to do something like this, but identifying the duplicates will be challenging at best. Probably the best way to do so would be to write (or borrow) a parser for the CSS files.

Anyone know of some application that would make this easier?
A_Jelly_Doughnut
User avatar
A_Jelly_Doughnut
MOD Team
MOD Team
 
Posts: 1751
Joined: Wed Jun 04, 2003 4:23 pm

Re: Remove duplicate css of stylesheet files

Postby Jhong » Thu Aug 26, 2010 4:10 am

firebug should be good enough -- it can show you the resultant CSS for the page.

A big +1 for combining the CSS into a single file (with a separate file for IE-specific hacks). It will make mods and administration much easier.
Jhong
Registered User
 
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

Re: Remove duplicate css of stylesheet files

Postby A_Jelly_Doughnut » Thu Aug 26, 2010 4:14 am

Jhong wrote:A big +1 for combining the CSS into a single file (with a separate file for IE-specific hacks). It will make mods and administration much easier.

That wasn't the proposal, as far as I understood it. What I understood from Raimon was to remove the CSS which is later contradicted by other CSS. And if that is the case, Firebug is of no help because it only shows the CSS which is in effect.
A_Jelly_Doughnut
User avatar
A_Jelly_Doughnut
MOD Team
MOD Team
 
Posts: 1751
Joined: Wed Jun 04, 2003 4:23 pm

Re: Remove duplicate css of stylesheet files

Postby Jhong » Thu Aug 26, 2010 5:40 am

Yes, the +1 was in response to rahber's comment. Digging through multiple CSS files is a pain.

If Firebug won't work, CSS Tidy might do the trick: http://csstidy.sourceforge.net/

I also wrote a CSS parser class ("CSS magic") for WP-United that parses CSS, performs operations (modifies selector specificity -- you don't need this) and then spits out the result: http://www.wp-united.com/svn/0.8.5/root ... -magic.php . However, it doesn't combine duplicate selectors (on purpose; CSS order can be important). It would be very easy to modify the addSelector() function to combine duplicates, but you'd also want to split selectors by ',' earlier than CSS Magic does it. You're welcome to use it... (gpl, usage examples at the top), but I expect a pre-built tool like CSS Tidy might work without any modification.
Jhong
Registered User
 
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

Re: Remove duplicate css of stylesheet files

Postby prototech » Sat Aug 28, 2010 4:24 am

I've created a task for this in the tracker: http://tracker.phpbb.com/browse/PHPBB3-9794
User avatar
prototech
MOD Team
MOD Team
 
Posts: 22
Joined: Mon Mar 12, 2007 12:25 am

Re: Remove duplicate css of stylesheet files

Postby Mighty Gorgon » Tue Jan 17, 2012 11:03 pm

This topic is a bit old... but I agree on the proposal about cleaning up CSS from duplicated color attributes.
User avatar
Mighty Gorgon
Registered User
 
Posts: 14
Joined: Wed Sep 17, 2003 8:52 am
Location: Italy


Return to [3.x] Discussion

Who is online

Users browsing this forum: No registered users and 10 guests