Great library, thank you for working on it. I'm creating a utility to process css files using CSS Parser. The idea is to separate out the inlined background-image styles (those base64 images in data_url) from the rest of the styles, so they can be loaded after document ready to speed the page load. The input is one css file, the output is two files, one without the inlined background-images and one with. I've got the utility working except that the CSSStyleRule that are produced all include the universal selector. So all selectors are prefixed with the universal selector (). I can hack it using regex, but I'm wondering if there is some way to do this with a formatter, or some setting I'm missing that will tell the parser not to add the universal selector. Thanks for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Ed,
thanks for your feedback.
Starting with version 0.9.16 we offer a realy limited output format control (see http://cssparser.sourceforge.net/outputFormatting.html). The idea is more or less to add formating options if requested by the user. I think your case will be a nice addition for this.
Can you please open a feature request for this.
Will implement that during the next days but it might require some days because i have to touch many classes to integrate the output formating a bit deeper into the lib. Will report the status based on the feature request and release a new snapshot if finished.
Hope that helps
RBRi
Last edit: RBRi 2015-09-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is my current solution, this works for my needs. I append to a StringBuilder. At the point at which I get the text for a single selector, I replace asterisk with the empty string. The confines the text replacement ot just selectors.
Great library, thank you for working on it. I'm creating a utility to process css files using CSS Parser. The idea is to separate out the inlined background-image styles (those base64 images in data_url) from the rest of the styles, so they can be loaded after document ready to speed the page load. The input is one css file, the output is two files, one without the inlined background-images and one with. I've got the utility working except that the CSSStyleRule that are produced all include the universal selector. So all selectors are prefixed with the universal selector (). I can hack it using regex, but I'm wondering if there is some way to do this with a formatter, or some setting I'm missing that will tell the parser not to add the universal selector. Thanks for your help.
Hi Ed,
thanks for your feedback.
Starting with version 0.9.16 we offer a realy limited output format control (see http://cssparser.sourceforge.net/outputFormatting.html). The idea is more or less to add formating options if requested by the user. I think your case will be a nice addition for this.
Can you please open a feature request for this.
Will implement that during the next days but it might require some days because i have to touch many classes to integrate the output formating a bit deeper into the lib. Will report the status based on the feature request and release a new snapshot if finished.
Hope that helps
RBRi
Last edit: RBRi 2015-09-29
Great, thank you. The feature request is here; https://sourceforge.net/p/cssparser/feature-requests/2/
Here is my current solution, this works for my needs. I append to a StringBuilder. At the point at which I get the text for a single selector, I replace asterisk with the empty string. The confines the text replacement ot just selectors.