Beispiel #1
0
    def getCompressed(self, profile):
        """Returns the compressed CSS code of this item."""

        field = "style:compressed[%s]-%s" % (self.id, profile.getId())
        mtime = self.getModificationTime(profile)

        compressed = self.project.getCache().read(field, mtime)

        if compressed is None:

            Console.info("Compressing tree %s...", Console.colorize(self.id, "bold"))

            # Start with the merged tree (includes resolved)
            tree = self.getMergedTree(profile)

            # Reduce tree
            Engine.reduceTree(tree, profile)

            # Compress tree
            compressed = Engine.compressTree(tree, profile.getCompressionLevel(), profile.getFormattingLevel())

            # Store in cache
            self.project.getCache().store(field, compressed, mtime)

        return compressed
Beispiel #2
0
    def process(self, code):
        callerName = inspect.stack()[1][3][5:]

        permutation = Permutation.Permutation({"jasy.engine": "gecko", "jasy.debug": True})

        tree = Engine.getTree(code, callerName)
        tree = Engine.permutateTree(tree, permutation)
        tree = Engine.reduceTree(tree)

        return Engine.compressTree(tree)
Beispiel #3
0
    def process(self, code):
        callerName = inspect.stack()[1][3][5:]

        permutation = Permutation.Permutation({
            "jasy.engine": "gecko",
            "jasy.debug": True
        })

        tree = Engine.getTree(code, callerName)
        tree = Engine.permutateTree(tree, permutation)
        tree = Engine.reduceTree(tree)

        return Engine.compressTree(tree)
Beispiel #4
0
    def process(self, code):
        callerName = inspect.stack()[1][3][5:]

        tree = Engine.getTree(code, callerName)
        return Engine.compressTree(tree)
Beispiel #5
0
    def process(self, code):
        callerName = inspect.stack()[1][3][5:]

        tree = Engine.getTree(code, callerName)
        tree = Engine.processTree(tree)
        return Engine.compressTree(tree)
Beispiel #6
0
logging.basicConfig(level=logging.DEBUG, format="%(message)s")

import jasy

import jasy.style.Engine as Engine
import jasy.style.output.Formatting as Formatting


for fname in sys.argv[2:]:
    text = open(fname, encoding="utf-8").read()
    
    print(">>> File: %s" % fname)
    
    if job == "optimize":    
        tree = Engine.getTree(text, fname)
        tree = Engine.processTree(tree)
        print(Engine.compressTree(tree))

    elif job == "compress":    
        formatting = Formatting.Formatting("blocks", "whitespace", "statements", "indent")
        tree = Engine.getTree(text, fname)
        tree = Engine.processTree(tree)
        print(Engine.compressTree(tree, formatting))
        
    elif job == "tree":
        print(Engine.getTree(text, fname).toXml())

    elif job == "tokens":
        Engine.printTokens(text, fname)

Beispiel #7
0
import jasy

import jasy.style.Engine as Engine
import jasy.style.output.Formatting as Formatting


for fname in sys.argv[2:]:
    text = open(fname, encoding="utf-8").read()

    print(">>> File: %s" % fname, file=sys.stderr)

    if job == "optimize":
        tree = Engine.getTree(text, fname)
        tree = Engine.reduceTree(tree)
        print(Engine.compressTree(tree))

    elif job == "compress":
        formatting = Formatting.Formatting("blocks", "whitespace", "statements", "indent")
        tree = Engine.getTree(text, fname)
        tree = Engine.reduceTree(tree)
        print(Engine.compressTree(tree, formatting))

    elif job == "reduced":
        formatting = Formatting.Formatting("blocks", "whitespace", "statements", "indent")
        tree = Engine.getTree(text, fname)
        tree = Engine.reduceTree(tree)
        print(tree.toXml())

    elif job == "tree":
        tree = Engine.getTree(text, fname)