Local Preview Guide
Local Preview Guide
This guide will help you preview your website locally before pushing to GitHub.
Prerequisites
- Ruby (version 2.5 or higher)
- Check if you have Ruby:
ruby --version - If not installed, install via Homebrew:
brew install ruby
- Check if you have Ruby:
- Bundler (Ruby gem manager)
- Install:
gem install bundler
- Install:
Setup Instructions
- Navigate to your project directory:
cd /Users/vchoudhary/Desktop/Personal_website/cvikash.github.io - Install dependencies:
bundle installThis will install all the gems specified in your
Gemfile, including Jekyll and the Minimal Mistakes theme. - Start the local server:
bundle exec jekyll serve - View your site:
- Open your browser and go to:
http://localhost:4000 - The site will automatically reload when you make changes to files
- Open your browser and go to:
Useful Commands
- Start server with drafts:
bundle exec jekyll serve --drafts- This will show draft posts (files in
_drafts/folder)
- This will show draft posts (files in
- Build without serving:
bundle exec jekyll build- Creates the
_site/folder with the generated site
- Creates the
- Incremental build (faster):
bundle exec jekyll serve --incremental- Only rebuilds changed files (faster for large sites)
Troubleshooting
Port already in use
If port 4000 is busy, use a different port:
bundle exec jekyll serve --port 4001
Dependencies issues
If you get errors about missing gems:
bundle update
GitHub Pages metadata warnings
These warnings are normal when running locally and won’t affect your site. They’re just informational messages about GitHub API authentication.
Making Changes
- Edit any file (HTML, Markdown, CSS, etc.)
- Save the file
- Jekyll will automatically rebuild
- Refresh your browser to see changes
Before Pushing to GitHub
- Stop the local server (Ctrl+C)
- Test that the site builds without errors:
bundle exec jekyll build - Commit and push your changes:
git add . git commit -m "Your commit message" git push
Your site will be live at: https://cvikash.github.io (or your GitHub Pages URL)