This is a playground for nanoc plugins, filters and commands.
Feel free to make with them as you please.
A command that validates the HTML and CSS files in the output folder. It uses the W3C online validator, so it needs network access.
It requires the
w3c_validators gem. Install it with
$ gem install w3c_validators
Use it with
$ nanoc validate
By default, it tries to validate HTML as XHTML 1.0 Transitional and CSS as CSS 2.0. You can change the options with the -d (doctype), -c (charset) and -p (CSS profile) options. For more info on options, run
$ nanoc help validate
A simple plugin to embed Gists on your content. To embed a gist, use:
<%= gist 8961 %>
It will include a small style definition (font: 12px Consolas) to make Gists easier to read.
A nanoc plugin that returns the path of a page given its page_id (its "name")
Installation: copy to your site's lib folder.
Usage: in your ERB-enabled layout or content, use:
<a href="<%= path_for :home %>">Home</a>
You can use a symbol or a string for your page name. Strings are nice for pages in subfolders:
<a href="<%= path_for "blog/2008/post_name" %>">A nice post</a>
A dumb filter that copies a binary asset to the output folder. Coded as an example of how a binary filter works.
Uses the 'sips' command line tool in Mac OS X to flatten Fireworks images. Output format can be defined in the asset's YAML file using the 'flatten_format' property:
binary: true filters: ['sips_flatten'] flatten_format: 'png'
flatten_format can be
png (the default),
It supports multiple asset representations, so you can output multiple formats by having a YAML like:
binary: true filters: ['sips_flatten'] reps: default: flatten_format: 'png' custom_path: /assets/image.png jpg: flatten_format: 'jpeg' custom_path: /assets/image.jpg
Uses the 'sips' command line tool in Mac OS X to build image thumbnails. Output format can be defined in the asset's YAML file using the 'thumbnail_format' property. Max width/height is set with the
binary: true filters: ['sips_thumbnail'] thumbnail_format: 'png' thumbnail_size: 200
thumbnail_format can be
png (the default),
It supports multiple asset representations, so you can output multiple thumbnails by having a YAML like:
binary: true filters: ['sips_thumbnail'] reps: big: thumbnail_size: 200 medium: thumbnail_size: 120 small: thumbnail_size: 64