示例#1
0
def reduceTree(tree, profile=None):
    """Applies all relevant modifications to the tree to allow compression to CSS."""

    Console.info("Reducing tree: %s...", tree.fileId)
    Console.indent()

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

    # PHASE 3
    # Resolve all mixins
    Mixins.processMixins(tree)
    Mixins.processSelectors(tree)
    ScopeScanner.scan(tree)
    Unused.cleanup(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
    # Execute variable resolution and method calls
    Executer.process(tree, profile)

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

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

    Console.outdent()

    return tree
示例#2
0
def reduceTree(tree, profile=None):
    """Applies all relevant modifications to the tree to allow compression to CSS."""

    Console.info("Reducing tree: %s...", tree.fileId)
    Console.indent()

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

    # PHASE 3
    # Resolve all mixins
    Mixins.processMixins(tree)
    Mixins.processSelectors(tree)
    ScopeScanner.scan(tree)
    Unused.cleanup(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
    # Execute variable resolution and method calls
    Executer.process(tree, profile)

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

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

    Console.outdent()

    return tree
示例#3
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)
示例#4
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