I'm using jstyleparser to parse the CSS and the issue is that when i try to save to a file by using rule.toString() the sizes found in the rules (width, padding, etc.. anything with a number) are saved with a decimal.
So for example if in the original CSS file width was 80px now when saving I get 80.0px
Is there a way to have it leave the size as it is? As in display a decimal only if it exists in the original CSS file.
Also is this the correct way to save a parsed CSS file, use toString() ?
All I need is to load the CSS and split it in other files based on the IE 4095 selectors limit.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Generally, the toString() method is not inteded for saving the CSS back. It is not guaranteed that you obtain a syntactically correct ouptut in all cases. If you need a perfect output that corresponds to your needs, I recommed to go through the SytleSheet and the Rules and format the ouput yourself. The StyleSheet is basically a collection as described here: http://cssbox.sourceforge.net/jstyleparser/manual.php#sheet
so it should be quite easy to go through it and do the same thing with the RuleSets.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using jstyleparser to parse the CSS and the issue is that when i try to save to a file by using rule.toString() the sizes found in the rules (width, padding, etc.. anything with a number) are saved with a decimal.
So for example if in the original CSS file width was 80px now when saving I get 80.0px
Is there a way to have it leave the size as it is? As in display a decimal only if it exists in the original CSS file.
Also is this the correct way to save a parsed CSS file, use toString() ?
All I need is to load the CSS and split it in other files based on the IE 4095 selectors limit.
Generally, the toString() method is not inteded for saving the CSS back. It is not guaranteed that you obtain a syntactically correct ouptut in all cases. If you need a perfect output that corresponds to your needs, I recommed to go through the SytleSheet and the Rules and format the ouput yourself. The StyleSheet is basically a collection as described here:
http://cssbox.sourceforge.net/jstyleparser/manual.php#sheet
so it should be quite easy to go through it and do the same thing with the RuleSets.