The default page was generated using files in content directory. It’s an introduction to Nanoc.
Here is my tweaked nanoc config:
Nanoc is shipped with a binary to create your app skeleton but it also allows you to:
(auto-)compile your sources into the resulting HTML
list available plugins
validates HTML / CSS
deploy your files to the server
HAML / SCSS / CoffeeScript
As said earlier, I use HAML to generate both website layout and content.
I’m a lazy guy. If I can automate things, I’ll do for sure.
So here comes Guard which is a gem that can watch directory and file changes and acts on changes.
I use it to automatically:
install gems when Gemfile is modified
re-compile website when config, rules, layout or contents changes
handle livereload to see modification live (without reloading page by hand) on my browser when a css, a js or an html file has changed
convert coffeescript files to CSS files
This way I always have the latest version in my browser and can modify anything on the fly.
One of the first thing to do is to defined your rules, this is how nanoc knows how it should compile files. Here’s the one I use on cavigneaux.net along with some explanations:
You may need to load extra-functionalities of Nanoc or create your own one. The lib/ directory is a good one for this since it is auto-loaded by Nanoc. This is the perfect place to put some kind of initializers and include helpers. Here is mine:
Pretty straightforward, I only need some link_to helper to use links creation. I also want to add a sitemap to my website. This modules will be of help.
Compile and deploy your website
In my case I use the included Rsync solution to upload my website to the server. With the sample configuration I gave you at the beginning, I tell Nanoc to use Rsync to keep my file in sync through SSH. I also asked Rsync to delete files not used anymore on the server.
With Nanoc you can have a powerful and customizable website content manager up and running in less than an hour. You’ll have to do the config stuff once and then you only have to think about your content, write it then deploy with a single command.
Nanoc is really worth checking it if you need a simple yet powerful content managing system for a static website.