AstroJS/botanjs/compressor/yui.py

29 lines
570 B
Python
Raw Permalink Normal View History

2015-08-14 10:12:10 +00:00
#!/usr/bin/env python3
import os
2021-09-05 15:16:37 +00:00
from sys import platform
2016-05-27 17:39:59 +00:00
from botanjs.config import Config as config
2015-08-14 10:12:10 +00:00
2016-05-27 17:39:59 +00:00
COMPILER = config[ "BotanJS" ][ "YuiCompressor" ]
2015-08-14 10:12:10 +00:00
if not os.path.isfile( COMPILER ):
raise Exception( "Compiler not found" )
COMPILER_OPTIONS = [
"--type css"
]
class Wrapper:
C = None
def __init__( self ):
self.C = "java -jar " + COMPILER + " " + " ".join( COMPILER_OPTIONS )
def compress( self, loc ):
2021-09-05 15:16:37 +00:00
if platform == "win32":
loc = loc.replace( "C:", "" ).replace( "\\\\", "/" )
os.system( self.C + " " + loc + " -o " + loc[:-4] + ".c.css" )