jekyll serve (locally) without building

html, jekyll, node.js

Solution

jekyll serve --skip-initial-build 

This will serve the site, skipping the initial build process. Additional configuration options for building and serving the site can be found here.

Problem

Jekyll generates a static site in a given directory (by default, `_site`). Running `jekyll serve` builds the site and then sets up a server such that the site can be viewed locally on the specified port (e.g. `localhost:4000` by default). I'm wondering if there is a way to activate this `serve` behavior without triggering the gem to recompile the site first. Alternatively, it would be sufficient to use some other tool to serve the site from a localhost port without using jekyll, but I'm not sure how to do that (node.js?). While I can open the static files directly in a browser, this doesn't find all the relative url links (to css, etc) correctly, defaulting links such as `/css/default.css` to the root `file://css/default.css` instead, which of course does not exist there. (This would be useful, for instance, because Jekyll takes quite some time to build a large site, and certain plugins I use need internet access to various APIs. It would be nice to view the site offline without triggering these).

Original source