예제 #1
0
파일: Style.py 프로젝트: Zenwolf/jasy
    def getCompressed(
        self, session, permutation=None, translation=None, optimization=None, formatting=None, context="compressed"
    ):

        tree = self.getMergedTree(permutation, session)

        # PHASE 1
        # Resolving conditionals
        self.__resolveConditionals(tree)

        # PHASE 2
        # Trivial cleanups
        ScopeScanner.scan(tree)
        Unused.cleanup(tree)

        # PHASE 3
        # Resolve all mixins
        Mixins.processExtends(tree)
        Mixins.processMixins(tree)
        Mixins.processSelectors(tree)

        # PHASE 4
        # Post mixin cleanups
        ScopeScanner.scan(tree)
        Unused.cleanup(tree)

        # PHASE 5
        # Compute variables
        Variables.compute(tree)

        # PHASE 6
        # Flattening selectors
        Flatter.process(tree)

        # PHASE 7
        # Post scan to remove (hopefully) all variable/mixin access
        ScopeScanner.scan(tree)

        # DONE
        return Compressor(formatting).compress(tree)
예제 #2
0
파일: Engine.py 프로젝트: Zenwolf/jasy
def processTree(tree):
    """
    Applies all relevant modifications to the tree to allow compression to CSS
    """

    # PHASE 2
    # Trivial cleanups
    ScopeScanner.scan(tree)
    Unused.cleanup(tree)

    # PHASE 3
    # Resolve all mixins
    Mixins.processMixins(tree)
    Mixins.processSelectors(tree)

    # PHASE 4
    # Assign selectors to mixins (support for extend)
    Mixins.processExtends(tree)

    # PHASE 5
    # Post mixin cleanups
    ScopeScanner.scan(tree)
    Unused.cleanup(tree)

    # PHASE 6
    # Compute variables
    Variables.compute(tree)

    # PHASE 7
    # Flattening selectors
    Flatter.process(tree)

    # PHASE 8
    # Post scan to remove (hopefully) all variable/mixin access
    ScopeScanner.scan(tree)

    return tree