#!/usr/bin/env python
from livereload import Server, shell
#import lesscpy
import webbrowser
#import os
#cmd = 'lesscpy -I ./css/*.less -o ./css ./css/'
#os.system(cmd)

#from six import StringIO
#print(lesscpy.compile(StringIO(u"a { border-width: 2px * 3; }"), minify=True))

server = Server()

# run a shell command
server.watch('./*.html')
server.watch('./js/*.js')
#server.watch('./css/*.less', shell(['lesscpy','css/main.less','css/']))
#server.watch('css/*.less', shell('lesscpy ./css/ -o ./css'))
server.watch('css/*.css')
#shell('lesscpy ./css/ -o ./css')

# run a function
#def alert():
#    print('foo')
#server.watch('foo.txt', alert)
# output stdout into a file

webbrowser.open('http://localhost:8152', new=2)

server.serve(port=8152, host='localhost')
