Previewing

Because nanoc runs on your local PC, the compiled site is not immediately put online on your server. This way, you can preview the entire site before uploading it to your host.

Previewing HTML files directly

The easiest way to preview the nanoc-generated site is by viewing the generated HTML files (usually residing in the output directory) directly.

If you are using absolute URLs (URLs that start with a slash, such as "/images/picture.png"), though, this won't work well: none of the CSS will be loaded, images won't show up, etc.

Using a staging server

You can set up a staging server using Apache, lighttpd, or anything else, to preview your site. However, this can be a time-consuming process, especially if you're not used to setting up web servers. Running a public web server might not even be possible.

Using heel

heel is a small web server aimed at serving static files. When running heel, it will start a local web server, and it will automatically open a browser window. This makes it an ideal companion to nanoc.

To get started, first install heel (you may also have to install dependencies, such as mongrel and launchy):

gem install heel

To start heel with the "output" directory as webroot, cd to the nanoc site directory and run

heel -r output

The server will be started and a browser window will pop up.

Using the nanoc autocompiler

nanoc 2.0 includes an autocompiler, which is a server that compiles pages on request. To run it, type:

nanoc aco

which will start the server on port 3000. If you want to customize the port, use the -p switch, like this:

nanoc aco -p 8080

Note that unlike heel, the browser does not automatically pop up, so don't keep waiting. :)