It's easy to include :py~pageit.render.Pageit
in your own scripts:
from pageit.render import Pageit
Pageit(path='.').clean().run()
Use :py~pageit.tools.watch
to call a callback function when files change:
from pageit.tools import watch
def my_func(path):
print path, 'has changed'
with watch(path='.', callback=my_func) as watcher:
watcher.loop() # wait for CTRL+C
watchdog for the cross-platform directory-watching library
Use :py~pageit.tools.serve
to serve up files on a given port:
from pageit.tools import serve
serve(path='.', port=80) # will wait until CTRL+C
Python's built-in SimpleHTTPServer for serving directories
If you want to watch and serve a path:
from pageit.tools import watch, serve
with watch(path, callback) as watcher:
serve(path, port) # wait for CTRL+C
api/render api/tools api/namespace