- gem install guard-shell guard-livereload
- put Guardfile in your working directory
- install livereload extension for your favorite browser
- start web server ( ex,
python -m SimpleHTTPServer
) - guard start
- open browser
- enable livereload extension
- edit your document & fun !
Created
November 9, 2011 06:45
-
-
Save wtnabe/1350638 to your computer and use it in GitHub Desktop.
reST-writing environment with realtime HTML-preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
source :rubygems | |
gem 'guard-shell' | |
gem 'guard-livereload' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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