Latest 100 public
snipts » clevercss
showing 1-2 of 2 snipts for clevercss
-
∞ script exemplo de utilização do clevercss
# retirado de http://sandbox.pocoo.org/clevercss/ import clevercss print clevercss.convert(''' body: background-color: $background_color ''', {'background_color: 'red.darken(10)'})
-
∞ css2clever translator. Simple and functional.
#!/usr/bin/python # -*- coding:utf-8 -*- #-------------------------------------- # # data: 30/11/2009 # author: italo moreira campelo maia # http://italomaia.com # http://eusouolobomau.blogspot.com/ # #-------------------------------------- import os, sys, time import clevercss as clever def parse(filepath): if filepath.endswith(".clever"): with open(filepath) as file: data = file.read() return clever.convert(data) def write(filename, data): with open(filename, 'w') as file: file.write(data) def write_clever(cfile, verb=False): data = parse(cfile) if verb: print "CLEVER FILE: ", cfile print "------------------------------------------" print "" print data print "" write("%s.css" % cfile[:-7], data) print ("%s.css criado." % cfile[:-7]) def print_help(): print "USAGE:" print "clever2css -c *.clever - cria" print "clever2css -c arquivo.clever - cria" print "clever2css -w *.clever - cria e observa por atualizações" print "clever2css -w arquivo.clever - cria e observa por atualizações" print "clever2css -q *.clever - modo simples" print "clever2css -q arquivo.clever - modo simples" print "clever2css -p *.clever - modo verborrágico" print "clever2css -p arquivo.clever - modo verborrágico" print "clever2css -q -p -c *.clever" print "clever2css -q -p -c arquivo.clever" def main(args): LIST=True WATCH=False CREATE=False PRINT=False if "-h" in args: print_help() exit(0) # quiet if "-q" in args: args.pop(args.index("-q")) LIST=False # create if "-c" in args: args.pop(args.index("-c")) CREATE=True if "-w" in args: args.pop(args.index("-w")) WATCH=True # print if "-p" in args: args.pop(args.index("-p")) PRINT=True if args: if LIST: print "" print "PROCESSANDO:" for arg in args: print "- %s" % arg print "" if any([WATCH, CREATE]): if WATCH: tdict = {} while True: for arg in args: ftime = os.path.getmtime(arg) if tdict.get(arg, False)!=ftime: tdict[arg]=ftime write_clever(arg, PRINT) time.sleep(0.5) elif CREATE: for arg in args: write_clever(arg, PRINT) else: print "Nada a fazer." if __name__=="__main__": main(sys.argv[1:])


