Closed (outdated)
Project:
Drupal core
Version:
9.5.x-dev
Component:
base system
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Jun 2009 at 18:57 UTC
Updated:
5 Aug 2022 at 16:56 UTC
Jump to comment: Most recent
Comments
Comment #1
sunsubscribing
Comment #2
boombatower commentedI would really like to build on #340283: Abstract SimpleTest browser in to its own object.
We can split up the CSS parsing as a separate class or section of the Page class which will be much cleaner then dumping it all in DrupalWebTestCase.
Comment #3
rfayIt actually turns out that we need CSS parsing for more than just simpletest. To do a reasonable job compressing and aggregating CSS, it has to be parsed. What we're doing now is pretty hacky, as exposed by #544568: CSS aggregation attempts to process @import in comment.
Comment #4
boombatower commentedNot sure how good of a job we want to do, but some resources to look at if we want a true parser/tokenizer.
http://csstidy.sourceforge.net/download.php
http://www.phpclasses.org/browse/package/1289.html
http://pear.php.net/package/PHP_CodeSniffer/download/1.2.0a1/
Something like this is much simpler and might be the solution for Drupal:
http://stackoverflow.com/questions/236979/parsing-css-by-regex
I'd be happy to try and write up a patch for this, just need some agreement on the approach to take.
Comment #5
boombatower commentedBased on #3 this should not be postponed if we put in base system.
Comment #6
robloachBAM!
Comment #7
rfay#444228: Optimize CSS option causes php cgi to segfault in pcre function "match" points out once again the folly of trying to aggregate CSS using regular expression techniques.
Comment #8
casey commentedsubscribing
I am working on a fix for several issues with the CSS aggregator: #641472: Fix CSS Aggregator.
Comment #9
catchDowngrading all D8 criticals to major per http://drupal.org/node/45111
Comment #10
jacinesubscribe :)
Comment #11
mattyoung commented~
Comment #12
mustanggb commentedSubscribe
Comment #13
jensimmons commentedsubscribing
Comment #14
jason.fisher commentedQueryPath to parse rules into a giant array/list/dictionary tree, then a weighted de-duplication algorithm?
I thnk if you can see each CSS rule as an incomplete transaction, where the selector is the transaction key/ID, the rules are key/values within a specific transaction, and the parsing order is the weight of updates to that transaction, you could then prototype different de-duplication/filtering algorithms of various aggressiveness in a semi-standardized manner. The CSS 'database' should be independent of dedupe or optimization, to allow community modules to improve on or provide algorithms of their own without concern of independent parsing.
Think of the node input filters .. you would want CSS input filters in a similiar vein. Colorizers would be a CSS "input fiter". CSS image-encode-and-embed would be a CSS filter. Filters are then associated with contexts and rules. The parser knows the module that generates each CSS code, so you could have a filter that removes or alters only module-specific or theme-specific CSS.
Thoughts?
Comment #15
Jeff Burnz commentedSubscriben....
Comment #16
danillonunes commentedSubscribe.
Comment #17
wim leersThis would almost certainly qualify as a feature, not a task. Writing this is a huge undertaking, and the probability of this being a very expensive way of doing CSS aggregation (even though it could then be smarter) is very high. As such, this would increase risk of delayed D8 release, so moving to D9.
I'm also very tempted to simply close this; now that we have #352951: Make JS & CSS Preprocessing Pluggable, it's possible to just plug in much smarter, non-PHP CSS minifiers if a site owner wants to do that.
Comment #18
catchComment #32
smustgrave commentedSince there hasn't been any movement since moving to PNMI 8 years ago moving to outdated.
Should also be noted simpletest is no longer used.
If you feel it's still an issue please feel free to reopen with an updated issue summary