def refresh(): if work_paths: work_files = [join('content', p, 'README.org') for p in work_paths] targets = ' '.join(f"'{f}'" for f in work_files) shell(f'touch {targets}')() else: make()
def compile_scss(): output = 'css/style.css' files = ' '.join([ 'scss/style.scss' ]) shell('sass --scss %s %s' % (files, output))()
def develop(): server = Server() server.watch('core/styles/*.less', shell('python core/generate_styles.py')) server.watch('core/*.py', shell('python core/generate_html.py')) server.watch('core/templates/*.html', shell('python core/generate_html.py')) server.serve(root='docs', port=5500)
def compile_ts(): output = 'js/app.js' files = ' '.join([ 'js/app.ts' ]) shell('tsc --out %s %s -t ES5' % (output, files))()
def main(): server = Server() server.watch('assets/scripts', shell('make assets')) server.watch('assets/images', shell('make assets')) server.watch('assets/styles', shell('make styles')) server.watch('src', shell('make html')) server.serve(root='build/', port=8080)
def livereload_docs(): """Run in shell as `protean livereload-docs`""" from livereload import Server, shell server = Server() server.watch("docs/**/*.rst", shell("make html")) server.watch("./*.rst", shell("make html")) server.serve(root="build/html", debug=True)
def compile_ts(): shell('python build.py', cwd='./ts/partials')() output = 'js/app.js' files = ' '.join( ['ts/app.ts', 'ts/partials/html.ts', 'ts/partials/sqlQuery.ts']) shell('tsc --out %s %s -t ES5' % (output, files))()
def live(): server = Server() server.watch('*.py', shell('make html', cwd='.')) server.watch('*.rst', shell('make html', cwd='.')) server.watch('ch*/', shell('make html', cwd='.')) server.serve(root='_build/html', liveport=35729, open_url_delay=1, debug=False)
def run_dev_server(conf, ip, port): from livereload import Server, shell server = Server() recreate_command = f"./run.py create -b http://{ip}:{port}" server.watch("dersite", shell(recreate_command)) server.watch(conf.template_dir, shell(recreate_command)) server.watch(conf.pages_dir, shell(recreate_command)) server.watch("config.toml", shell(recreate_command)) server.serve(host=ip, port=port, root=conf.output_dir)
def serve_docs(): from livereload import Server, shell build_command = "sphinx-build -b html docs dist/docs" run(build_command) server = Server() server.watch("*.rst", shell(build_command)) server.watch("docs/", shell(build_command)) server.serve(root="dist/docs")
def main(): """main routine""" make_cmd = 'make html' if platform.system() == 'FreeBSD': make_cmd = 'gmake html' server = Server() server.watch('docs/*.rst', shell(make_cmd, cwd='docs')) server.watch('pysftp/*.py', shell(make_cmd, cwd='docs')) webbrowser.open_new_tab('http://localhost:5500') server.serve(root='docs/_build/html', host='0.0.0.0')
def serve_docs(): from livereload import Server, shell build_command = 'sphinx-build -b html docs dist/docs' run(build_command) server = Server() server.watch('*.rst', shell(build_command)) server.watch('docs/', shell(build_command)) server.serve(root='dist/docs')
def compile_ts(): shell('python build.py', cwd='./ts/partials')() output = 'js/app.js' files = ' '.join([ 'ts/app.ts', 'ts/partials/html.ts', 'ts/partials/sqlQuery.ts' ]) shell('tsc --out %s %s -t ES5' % (output, files))()
def main(): build_project_path = '_build' if not os.path.exists(build_project_path): os.system('make html') server = Server() server.watch('./*.rst', shell('make html')) server.watch('./*/*.rst', shell('make html')) webbrowser.open_new_tab('http://127.0.0.1:5500') server.serve(root='_build/html')
def serve_livereload(): local('make clean') local('make html') os.chdir('output') server = livereload.Server() server.watch('../content/*.rst', livereload.shell('pelican -s ../pelicanconf.py -o ../output')) server.watch('../naffy/', livereload.shell('pelican -s ../pelicanconf.py -o ../output')) server.watch('*.html') server.watch('*.css') server.serve(liveport=35729, port=PORT)
def live_build(port=8080): local('make clean') # 1 local('make html') # 2 os.chdir('output') # 3 server = livereload.Server() # 4 server.watch('../content/*.md', # 5 livereload.shell('pelican -s ../pelicanconf.py -o ../output')) # 6 server.watch('../pelican-octopress-theme/', # 7 livereload.shell('pelican -s ../pelicanconf.py -o ../output')) # 8 server.watch('*.html') # 9 server.watch('*.css') # 10 server.serve(liveport=35729, port=port) # 11
def live_build(port=8080): local('make clean') # 1 local('make html') # 2 os.chdir('output') # 3 server = livereload.Server() # 4 server.watch('../content/*.rst', # 5 livereload.shell('pelican -s ../pelicanconf.py -o ../output')) # 6 server.watch('../pelican-themes/notmyidea-cms/', # 7 livereload.shell('pelican -s ../pelicanconf.py -o ../output')) # 8 server.watch('*.html') # 9 server.watch('*.css') # 10 server.serve(liveport=35729, port=port) # 11
def live_build(port=PORT): """ Need pip install livereload """ local('make clean') # 1 local('make html') # 2 os.chdir('output') # 3 server = livereload.Server() # 4 server.watch('../content/*.md', # 5 livereload.shell('pelican -s ../pelicanconf.py -o ../output')) # 6 server.watch('../content/pages/*.md', # 7 livereload.shell('pelican -s ../pelicanconf.py -o ../output')) # 8 server.watch('*.html') server.watch('*.css') server.serve(liveport=35729, port=port)
def watch(filename, port=9000): from livereload import Server, shell server = Server() server.watch(filename, shell(f'./structurize.py {filename}', output='index.html')) server.serve(root='.', open_url=True, port=port)
def live_build(port=8080): local('make clean') # 1 local('make html') # 2 os.chdir('output') # 3 server = livereload.Server() # 4 local('open http://localhost:8080') server.watch('../content/*.ipynb') server.watch('../content/*.md') server.watch('../content/*.rst', # 5 livereload.shell('pelican -s ../pelicanconf.py -o ../output')) # 6 server.watch(os.path.join('/Users/stephanfitzpatrick', 'pelican-themes', 'iris'), # 7 livereload.shell('pelican -s ../pelicanconf.py -o ../output')) # 8 server.watch('*.html') # 9 server.watch('*.css') # 10 server.watch('./pelicanconf.py') server.serve(liveport=35729, port=port) # 11
def id3(audio, episode, title, image): """ Update ID3 tags with episode info. """ if not episode: # Try to detect episode from audio filename match = re.search(r'e(\d{2,})', audio) if not match: raise click.UsageError('Could not be detected episode. Use --episode option.') episode = int(match.group(1)) id3 = eyed3.load(audio) id3.initTag(version=ID3_V2_3) id3.tag.title = title id3.tag.artist = 'Henrique Bastos' id3.tag.album = 'Curto Circuito Podcast' id3.tag.track_num = episode id3.tag.genre = 'Podcast' if image: image = Path(image) data = image.read_file('rb') mime = 'image/' + image.ext[1:] # HACK to make APIC header readable on iTunes # EYED3 sets v2.3 encoding to UTF-16, but iTunes only reads LATIN-1 from eyed3.id3 import frames def force_latin1(self): self.encoding = eyed3.id3.LATIN1_ENCODING setattr(frames.ImageFrame, '_initEncoding', force_latin1) # force mime as str because eyeD3 uses it to compose the binary header # PUBLISHER_LOGO == 0x14 id3.tag.images.set(0x14, data, str(mime)) id3.tag.save(version=ID3_V2_3) # Print id3 shell(['eyeD3', audio])
def live_build(port=8080): local('make clean') local('make html') os.chdir(env.deploy_path) server = livereload.Server() server.watch('../pelicanconf.py', livereload.shell('pelican -s pelicanconf.py -o output', cwd='../')) server.watch('../content/', livereload.shell('pelican -s pelicanconf.py -o output', cwd='../')) server.watch('../themes/authentiq-theme/', livereload.shell('pelican -s pelicanconf.py -o output', cwd='../')) server.watch('*.html') server.watch('*.css') server.serve(liveport=35729, port=port)
def server(port=5500, output=OUTPUT, content=CONTENT, extensions=EXTENSIONS): shell('make clean') shell('make html') os.chdir(output) server = Server() cmd = 'pelican -s {} -o {}'.format(str(ROOT / 'pelicanconf.py'), output) for ext in extensions: print(content / ext) server.watch(str(content / ext), cmd) print(ROOT / 'themes') server.watch(str(ROOT / 'themes'), cmd) server.watch(str(output / '*.html')) server.watch(str(output / '*.css')) server.serve(liveport=35729, port=port)
def develop_watch(options): server = Server() reloader = shell('pkill -HUP gunicorn') def js_bundle_changed(): copy_js_bundle(options) server.watch('/mnt/src/front_demo/dist/main.js', js_bundle_changed) server.watch('/mnt/src/clang_ast_webservice/*.py', reloader) server.watch('/mnt/src/clang_ast_webservice/assets/*', reloader) server.serve() sys.exit(1)
def server(sitename): server = Server() server.watch(os.path.join('sites', sitename, 'content'), shell('python sitegen.py compile '+sitename)) server.watch(os.path.join('sites', sitename, 'media'), shell('python sitegen.py collectmedia '+sitename)) server.watch(os.path.join('sites', sitename, 'static', 'javascript'), shell('python sitegen.py generatestatic '+sitename)) server.watch(os.path.join('sites', sitename, 'static', 'styles'), shell('python sitegen.py generatestatic '+sitename)) server.watch(os.path.join('sites', sitename, 'templates'), shell('python sitegen.py compile '+sitename+' --force')) server.watch(os.path.join('static'), shell('python sitegen.py generatestatic '+sitename)) server.watch(os.path.join('templates'), shell('python sitegen.py compile '+sitename+' --force')) server.serve(root=os.path.join('generated', sitename),port=8000, host='localhost')
def serve(args): project_dir = args.directory if (project_dir / "config.yaml").exists(): user_config = config.config_from_file(project_dir / "config.yaml") else: user_config = config.DEFAULT_CONFIG serve_dir = project_dir / user_config["build_dir"] watch_dir = project_dir / user_config["source_dir"] server = Server() server.watch(watch_dir, shell(f"inkblot build {project_dir}")) server.serve(root=serve_dir, port=args.port, open_url_delay=0.5)
def main(): os.environ.setdefault("DJANGO_SETTINGS_MODULE", "prototype.settings") from django.core.wsgi import get_wsgi_application from livereload import Server, shell application = get_wsgi_application() server = Server(application) server.watch('prototype.yml', reload_server) server.watch('templates/') server.watch('styles/', shell(['sassc', 'styles/main.scss', 'static/css/main.css'])) server.serve(port=8000)
def watch() -> None: """ Start a developing server for your content """ # Get where the execution is being made base_path = os.getcwd() theme = load_config_file(base_path)['theme'] content_folder = os.path.join(base_path, 'content') theme_folder = os.path.join(base_path, 'themes') # Initialize the dev server server = Server() # Build content content = build_content(base_path) render_content(base_path, content, theme) copy_static_assets(base_path, theme) server.watch(content_folder, shell("arcade build", cwd=base_path)) server.watch(theme_folder, shell("arcade build", cwd=base_path)) server.serve(root="public")
def run(self, doc_root, build_dir=None, port=5500, use_makefile=True): # Set up sphinx resources doc_root = self._sphinx.get_documentation_root(doc_root) doc_root = os.path.abspath(doc_root) if build_dir is None: build_dir = self._sphinx.get_build_directory(doc_root) html_dir = self._sphinx.get_html_directory(build_dir) if use_makefile: build_cmd = self._sphinx.get_make_command(build_dir) else: source_dir = self._sphinx.estimate_source_directory(doc_root) build_cmd = self._sphinx.get_sphinx_build_command( source_dir, build_dir) build_func = livereload.shell(build_cmd, cwd=doc_root) self._run(build_func, html_dir, port=port)
def start(host, port): app = Flask( __name__, static_folder='/static' ) app.config['DEBUG'] = True @app.route('/') def index(): template_name = request.args.get('template') vars_file = request.args.get('vars') make_pdf = request.args.get('pdf') if template_name is None: return usage if vars_file is not None: with open(os.path.join('template-vars', vars_file), 'r') as f: template_vars = json.load(f) else: template_vars = {} for folder in jinja_config['template_folders']: copy_tree(folder, '/static', update=1) env = create_environment(jinja_config) template = env.get_template(template_name) rendered = template.render(**template_vars).encode('utf-8') if make_pdf: print('MAKING PDF!') with open('/static/pdf_tmp.html', 'wb') as pdf: pdf.write(rendered) Popen(render_pdf_cmd, shell=True).wait() return rendered server = Server(app.wsgi_app) watched_files = formic.FileSet(include='**/*', exclude=['templates/**/*.css', 'templates/pdf_tmp.html', '**/*.pdf']) for file_name in watched_files: server.watch(file_name, shell( 'node-sass-chokidar scss -o templates' )) server.serve(host=host, port=port, liveport=35729)
def _live_build(mode, port=8585): local('make clean') if mode == 'prod': local('make publish') conf = 'publishconf' elif mode == 'dev': local('make html') conf = 'pelicanconf' else: raise ValueError(f"Invalid conf: {conf}") os.chdir('output') server = livereload.Server() server.watch('../content/*.rst', livereload.shell(f'pelican -s ../{conf}.py -o ../output')) server.watch('*.html') server.watch('*.css') server.serve(liveport=35729, host='0.0.0.0', port=port)
def cmd(tool_opts, open_browser, tool, source): with tempdir() as dirpath: server = Server() source_abspath = os.path.abspath(source) command_instance = get_command(tool, source_abspath, dirpath, tool_opts) command_str = str(command_instance) sh = shell(command_str, cwd=dirpath) sh() server.watch(source, sh) image_filepath = command_instance.destination image_filename = os.path.basename(image_filepath) page = render(image_filename) deploy(dirpath, page) server.serve(root=dirpath, open_url_delay=open_browser)
def server(sitename): server = Server() server.watch(os.path.join('sites', sitename, 'content'), shell('python sitegen.py compile ' + sitename)) server.watch(os.path.join('sites', sitename, 'media'), shell('python sitegen.py collectmedia ' + sitename)) server.watch(os.path.join('sites', sitename, 'static', 'javascript'), shell('python sitegen.py generatestatic ' + sitename)) server.watch(os.path.join('sites', sitename, 'static', 'styles'), shell('python sitegen.py generatestatic ' + sitename)) server.watch(os.path.join('sites', sitename, 'templates'), shell('python sitegen.py compile ' + sitename + ' --force')) server.watch(os.path.join('static'), shell('python sitegen.py generatestatic ' + sitename)) server.watch(os.path.join('templates'), shell('python sitegen.py compile ' + sitename + ' --force')) server.serve(root=os.path.join('generated', sitename), port=8000, host='localhost')
def start(host, port): app = Flask(__name__, static_folder='/static') app.config['DEBUG'] = True @app.route('/') def index(): template_name = request.args.get('template') vars_file = request.args.get('vars') make_pdf = request.args.get('pdf') if template_name is None: return usage if vars_file is not None: with open(os.path.join('template-vars', vars_file), 'r') as f: template_vars = json.load(f) else: template_vars = {} for folder in jinja_config['template_folders']: copy_tree(folder, '/static', update=1) env = create_environment(jinja_config) template = env.get_template(template_name) rendered = template.render(**template_vars).encode('utf-8') if make_pdf: print('MAKING PDF!') with open('/static/pdf_tmp.html', 'wb') as pdf: pdf.write(rendered) Popen(render_pdf_cmd, shell=True).wait() return rendered server = Server(app.wsgi_app) watched_files = formic.FileSet( include='**/*', exclude=['templates/**/*.css', 'templates/pdf_tmp.html', '**/*.pdf']) for file_name in watched_files: server.watch(file_name, shell('node-sass-chokidar scss -o templates')) server.serve(host=host, port=port, liveport=35729)
def live_build(port=8000): local('make clean') local('make html') os.chdir('output') server = livereload.Server() server.watch('../content/*.rst', livereload.shell('pelican -s ../pelicanconf.py -o ../output')) server.watch('../', livereload.shell('pelican -s ../pelicanconf.py -o ../output')) server.watch('../theme/', livereload.shell('pelican -s ../pelicanconf.py -o ../output')) server.watch('../theme/templates/', livereload.shell('pelican -s ../pelicanconf.py -o ../output')) server.watch('../theme/static/', livereload.shell('pelican -s ../pelicanconf.py -o ../output')) server.watch('../theme/static/css/', livereload.shell('pelican -s ../pelicanconf.py -o ../output')) server.watch('*.html') server.watch('*.css') server.serve(liveport=35729, port=port)
#!/usr/bin/env python from subprocess import call # initial make call(["python", "-m", "sphinx", ".", "/tmp/_build"]) from livereload import Server, shell server = Server() server.watch("..", shell("python -m sphinx . /tmp/_build")) server.serve(root="/tmp/_build/", liveport=35730, port=8001, host="0.0.0.0")
def make(): shell('make local')()
def docs_serve(): server = Server() server.watch('docs/*.rst', shell('make html', cwd='docs')) server.serve(root='docs/_build/html', open_url=True)
from livereload import Server, shell server = Server() server.watch('./src/scss', shell('make compile-scss')) server.watch('./src/js', shell('make compile-js')) server.watch('./index.html') server.serve()
from livereload import Server, shell server = Server() server.watch('generator/', shell('build.bat', cwd='.', shell=True)) server.serve(root='docs')
def live_build(port=8083): local('make clean') # 1 local('make html') # 2 os.chdir('./output') # 3 server = livereload.Server() # 4 pelican_build = 'pelican ../content -o . -s ../pelicanconf.py' server.watch('../content/posts/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/devops/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/pages/*.rst', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/pages/tools/*.rst', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/raspberry_pi2/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/how-to/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/makefile-tutorial/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/meditations/mongodb-geojson/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/coding/*.rst', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/python-mongodb/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/python-mongodb/grilled_flpd_data/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/coding/javascript/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/coding/*.ipynb', # 5 livereload.shell(pelican_build)) # 6 server.watch('../content/posts/meta/*.rst', # 5 livereload.shell(pelican_build)) # 6 server.watch('../themes/pelican-themes/aboutwilson/templates/*.html', # 7 livereload.shell(pelican_build)) # 8 server.watch('*.html') # 9 server.watch('*.css') # 10 server.serve(host='0.0.0.0', liveport=35729, port=port) # 11
You need to have installed package with extra requirements ``dev`` to use it. Once launched, server will be available on port 8002, like: :: http://localhost:8002/ Borrowed from: :: https://livereload.readthedocs.io/en/latest/#script-example-sphinx """ from livereload import Server, shell server = Server() # Watch RST documents sources server.watch("docs/*.rst", shell("make html", cwd="docs")) server.watch("docs/api/*.rst", shell("make html", cwd="docs")) # Watch application sources server.watch("optimus/*.py", shell("make html", cwd="docs")) server.watch("optimus/*/**.py", shell("make html", cwd="docs")) # Serve the builded documentation server.serve( root="docs/_build/html", port=8002, host="0.0.0.0", )
def live(): server = Server() server.watch('docs', shell('paver build_html', cwd='.')) server.serve(root='_build/html', open_url_delay=True)
def compile_html_partials(): output = 'js/partials/html.ts' shell('tss html *.html', output=output, cwd='./js/partials', shell=True)()
#!/usr/bin/env python from livereload import Server, shell server = Server() server.watch('*.rst', shell('make html')) server.serve(open_url=False)
def do_livereload(): server = Server(app.wsgi_app) server.watch('sass',shell("compass compile -c config.rb"),delay="forever") server.watch('application/static') server.watch('application/templates') server.serve(liveport=35729,debug=True,restart_delay=2)
} handlers = { 'index': FancyCollectionHandler(index, mount_points, paths), 'packages': filter_path( # pylint: disable=no-value-for-parameter DirectoryApp(paths['packages'], index_page=None), filters['packages']), 'assets': filter_path( # pylint: disable=no-value-for-parameter DirectoryApp(paths['assets'], index_page=None), filters['assets']), } routes = [ (route, {'GET': handlers[resource]}) for resource, route in mount_points.items() ] return Selector(mappings=routes) app = application() # pylint: disable=invalid-name if __name__ == '__main__': server = livereload.Server(app) # pylint: disable=invalid-name server.watch( 'pypiple/static/style.scss', livereload.shell( 'sassc --sourcemap --source-comments ' 'pypiple/static/style.scss pypiple/static/style.css')) server.serve(port=3000, host='0.0.0.0')
#!/usr/bin/env python from livereload import Server, shell server = Server() server.watch('content', shell('lightning -o www')) server.serve(root='www')
Once launched, server will be available on port 8002, like: :: http://localhost:8002/ Borrowed from: :: https://livereload.readthedocs.io/en/latest/#script-example-sphinx """ from livereload import Server, shell server = Server() # Watch root documents server.watch('docs/*.rst', shell('make html', cwd='docs')) # Watch plugin documents server.watch('docs/plugins/*.rst', shell('make html', cwd='docs')) # Watch plugin models since plugin documents use autodoc on them server.watch('cmsplugin_blocks/models/*.py', shell('make html', cwd='docs')) # Watch app settings file used in install document server.watch('cmsplugin_blocks/settings.py', shell('make html', cwd='docs')) # Watch template tag file used in smart-format document server.watch('cmsplugin_blocks/templatetags/smart_format.py', shell('make html', cwd='docs')) # Serve the builded documentation
args.rev_url = f'https://github.com/ClickHouse/ClickHouse/commit/{args.rev}' args.events = get_events(args) if args.test_only: args.skip_multi_page = True args.skip_website = True args.skip_pdf = True args.skip_amp = True if args.skip_git_log or args.skip_amp: mdx_clickhouse.PatchedMacrosPlugin.skip_git_log = True from build import build build(args) if args.livereload: new_args = [ arg for arg in sys.argv if not arg.startswith('--livereload') ] new_args = sys.executable + ' ' + ' '.join(new_args) server = livereload.Server() server.watch(args.docs_dir + '**/*', livereload.shell(new_args, cwd='tools', shell=True)) server.watch(args.website_dir + '**/*', livereload.shell(new_args, cwd='tools', shell=True)) server.serve(root=args.output_dir, host='0.0.0.0', port=args.livereload) sys.exit(0)
#!/usr/bin/env python from livereload import Server, shell server = Server() server.watch('docs/*', shell('make docs')) server.watch('computerwords/*.py', shell('make docs')) server.watch('computerwords/*/*.py', shell('make docs')) server.watch('computerwords/*/*.css', shell('make docs')) server.watch('computerwords/*/*.html', shell('make docs')) server.serve(root='docs/build')
#!/usr/bin/env python from livereload import Server, shell server = Server() server.watch('style.less', shell('lessc style.less', output='style.css')) server.serve(open_url=True)
#!/usr/bin/env python """ This module is designed to used with _livereload to make it a little easier to write Sphinx documentation. Simply run the command:: python sphinx_server.py and browse to http://localhost:5500 livereload_: https://pypi.python.org/pypi/livereload """ from livereload import Server, shell server = Server() server.watch('*.rst', shell('make html', cwd='.')) server.watch('examples/*.rst', shell('make html', cwd='.')) server.watch('conf.py', shell('make html', cwd='.')) server.serve(root='_build/html')
from livereload import Server, shell server = Server() def alert(): print('foo') server.watch('./temp.py', alert) # run a shell command server.watch('./temp.py', shell('python3 ./temp.py', output='aa.log')) server.serve(debug=True)
from livereload import Server, shell server = Server() build_docs = shell("make html") print("Doing an initial build of the docs...") build_docs() server.watch("source/*.rst", build_docs) server.watch("source/**/*.rst", build_docs) server.serve(root="build/html")
You need to have installed package with extra requirements ``dev`` to use it. Once launched, server will be available on port 8002, like: :: http://localhost:8002/ Borrowed from: :: https://livereload.readthedocs.io/en/latest/#script-example-sphinx """ from livereload import Server, shell server = Server() # Watch source documents (not recursive) server.watch("docs/*.rst", shell("make html", cwd="docs")) server.watch("docs/api/*.rst", shell("make html", cwd="docs")) server.watch("docs/usage/*.rst", shell("make html", cwd="docs")) # Watch modules for autodoc review server.watch("py_css_styleguide/*.py", shell("make html", cwd="docs")) server.watch("py_css_styleguide/*/**.py", shell("make html", cwd="docs")) # Serve the builded documentation server.serve( root="docs/_build/html", port=8002, host="0.0.0.0", )
from livereload import Server, shell if __name__ == '__main__': server = Server() server.watch('*.rst', shell('make html'), delay=1) server.watch('*.md', shell('make html'), delay=1) server.watch('*.py', shell('make html'), delay=1) server.watch('_static/*', shell('make html'), delay=1) server.watch('_templates/*', shell('make html'), delay=1) server.serve(root='_build/html')
#!/usr/bin/env python from livereload import Server, shell server = Server() server.watch('*.rst', shell('make html', cwd='.')) server.watch('*/*.rst', shell('make html', cwd='.')) server.watch('*/*/*.rst', shell('make html', cwd='.')) server.serve(root='_build/html', host='0.0.0.0')