Skip to content

Instantly share code, notes, and snippets.

@jmacego
Last active March 14, 2019 20:44
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 jmacego/3594743c8463c54747e909c4336d4bc5 to your computer and use it in GitHub Desktop.
Save jmacego/3594743c8463c54747e909c4336d4bc5 to your computer and use it in GitHub Desktop.
Bash function to pull jekyll site and serve
#!/bin/bash
# Profile function to add a convenient jekyllserve command and also a
# function to cd to the directory, do a git pull, open in sublime,
# serve the site and then open it in a web browser.
#
# Works on OSX with sublime CLI installed. YMMV for other platforms.
# You also probably want to rename things. Consider this a template.
#
# Also... I just have this in my ~/.profile so I type jmaclabs and it
# just works. Here's how that looks different:
# Aliases and Functions:
#
# alias jekyllserve="bundle exec jekyll serve --watch --livereload --host 0.0.0.0 --port 8000"
#
# jmaclabs() {
# cd ~/git/jmacego.github.io
# git pull
# subl .
# bash -c "sleep 5; open 'http://localhost:8000'" &
# jekyllserve
# }
jmaclabs() {
cd ~/git/jmacego.github.io
git pull
subl .
bash -c "sleep 5; open 'http://localhost:8000'" &
bundle exec jekyll serve \
--watch \
--livereload \
--host 0.0.0.0 \
--port 8000
}
jmaclabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment