Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Created November 9, 2011 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtnabe/1350638 to your computer and use it in GitHub Desktop.
Save wtnabe/1350638 to your computer and use it in GitHub Desktop.
reST-writing environment with realtime HTML-preview

reST-writing environment with realtime HTML-preview

  1. gem install guard-shell guard-livereload
  2. put Guardfile in your working directory
  3. install livereload extension for your favorite browser
  4. start web server ( ex, python -m SimpleHTTPServer )
  5. guard start
  6. open browser
  7. enable livereload extension
  8. edit your document & fun !
# -*- mode: ruby -*-
source :rubygems
gem 'guard-shell'
gem 'guard-livereload'
# -*- mode: ruby -*-
def html_file( file )
File.join(
File.dirname(file),
File.basename(file, File.extname(file)) + '.html')
end
guard :shell do
watch( /(.*\.rst)$/ ) { |m|
system "rst2html.py #{m[1]} #{html_file(m[1])}"
}
end
guard :livereload do
watch( /(.*\.html)\z/ ) { |m| html_file(m[1]) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment