Affects Version/s: None
Fix Version/s: 0.4.0
Specification of this task is incomplete
Currently, SmartSprites uses a very simple line-based algorithm for parsing CSS. This was enough for the initial versions, but blocks implementation of more advanced and user-friendly features, such as breaking SmartSprites directives into multiple lines, removing original background-* properties.
The initial implementation idea is to use some of the available ANTLR CSS grammars and extend it to support SmartSprites directives. Ideally, SmartSprites would parse the whole CSS file and copy the CSS rules that don't have SmartSprites directives unchanged to the output.
Implementing this task is a good opportunity to refactor a few things in the code:
- Drop passing various data structures as method parameters in favour of a context object that holds all available data structures.
- Think about refactoring sprite building tests to further reduce duplication and include testing through API calls, command line calls and Ant task calls. Ideally, all the expected results should be kept in one place and just verified three times for different calling mode.
One important risk related to parser-based processing is that if the parser does not support some of the syntax used in the CSS file (@import, IE5 hacks), the whole processing may fail (with a parse error).