Remove duplicate css of stylesheet files

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
User avatar
Raimon
Former Team Member
Posts: 67
Joined: Sun Mar 19, 2006 1:21 pm
Contact:

Remove duplicate css of stylesheet files

Post by Raimon »

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
ameeck
Registered User
Posts: 86
Joined: Sun Nov 13, 2005 6:43 pm
Location: Prague, Czech Republic
Contact:

Re: Remove duplicate css of stylesheet files

Post by ameeck »

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
rahber
Former Team Member
Posts: 14
Joined: Mon Feb 02, 2009 10:08 am
Contact:

Re: Remove duplicate css of stylesheet files

Post by rahber »

+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
A_Jelly_Doughnut
Registered User
Posts: 1780
Joined: Wed Jun 04, 2003 4:23 pm

Re: Remove duplicate css of stylesheet files

Post by A_Jelly_Doughnut »

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

Jhong
Registered User
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

Re: Remove duplicate css of stylesheet files

Post by Jhong »

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.

User avatar
A_Jelly_Doughnut
Registered User
Posts: 1780
Joined: Wed Jun 04, 2003 4:23 pm

Re: Remove duplicate css of stylesheet files

Post by A_Jelly_Doughnut »

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

Jhong
Registered User
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

Re: Remove duplicate css of stylesheet files

Post by Jhong »

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.

User avatar
prototech
Former Team Member
Posts: 53
Joined: Mon Mar 12, 2007 12:25 am

Re: Remove duplicate css of stylesheet files

Post by prototech »

I've created a task for this in the tracker: http://tracker.phpbb.com/browse/PHPBB3-9794

User avatar
Mighty Gorgon
Registered User
Posts: 14
Joined: Wed Sep 17, 2003 8:52 am
Location: Italy
Contact:

Re: Remove duplicate css of stylesheet files

Post by Mighty Gorgon »

This topic is a bit old... but I agree on the proposal about cleaning up CSS from duplicated color attributes.

Post Reply