Uploaded image for project: 'SmartSprites'
  1. SmartSprites
  2. SMARTSPRITES-47

Replace line-based CSS processing with a parser-based one

    Details

    • Type: Task
    • Status: Open
    • Priority: Blocker
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 0.4.0
    • Labels:
      None

      Description

      Specification of this task is incomplete

      Motivation

      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.

      Implementation

      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.

      Refactorings

      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.

      Discussion

      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).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stachoo Stanisław Osiński
                Reporter:
                stachoo Stanisław Osiński
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: