Nanoc

Release notes

This page summarizes new features in minor releases. For a detailed list of all changes in all versions, see the Detailed release notes page.

Nanoc 4.6

Nanoc 4.6 adds #snapshot? to item representations. It returns true if the given representations has a snapshot with the given name, false otherwise. For example:

<% if @rep.snapshot?(:latex) %>
  <link rel=stylesheet href=latex.css>
<% end %>

The #content_for function, part of the capturing helper (see the Capturing section on the Helpers page for details), can now be used to set captured content directly:

content_for(:head, 'stuff')

Previously, setting captured content manually was only possible by appending to _erbout:

content_for(:head) { _erbout << 'stuff' }

When passing a string to the #content_for function, parameters are passed before the string argument:

content_for(:head, existing: :append, 'stuff')

Lastly, items and layouts now have #raw_content= during preprocessing, to allow changing the raw content of items and layouts.

Nanoc 4.5

Nanoc 4.5 bundles the Git deployer, which used to be in the nanoc-git repository. The nanoc-git gem can be removed from the Gemfile. For details, see the With GitHub Pages or Bitbucket section on the Deploying Nanoc sites page.

Nanoc 4.4

Nanoc 4.4 adds support for environments. The compile command now takes an --env option, e.g. nanoc compile --env=prod, which sets the NANOC_ENV environment variable to the given value, and also changes the way the configuration is read.

The configuration can now contain an environments section, like this:

base_url: http://nanoc.dev

environments:
  prod:
    base_url: http://nanoc.ws
  staging:
    base_url: http://staging.nanoc.ws

When an environment is specified on the command line, the data for the environment with the given name will be merged into the top level of the configuration. For example, with --env=prod, the configuration effectively becomes as follows:

base_url: http://nanoc.ws

For details about environments, see the Environments section on the Sites page.

Nanoc 4.3

Nanoc 4.3 adds Nanoc::Filter.define, which makes defining filters a little less verbose:

Nanoc::Filter.define(:censor) do |content, params|
  content.gsub('Nanoc sucks', 'Nanoc rocks')
end

See the Writing filters section on the Filters page for details.

Additionally, Nanoc will automatically require all gems defined in the nanoc group in the Gemfile. This is particularly useful for the guard-nanoc gem, which, when added to the nanoc group in the Gemfile, will add a new live command to nanoc. This nanoc live command simultaneously recompiles the site on changes, and runs a web server. See the guard-nanoc repository for details.

Nanoc 4.2 and older

Release notes are pending. For the time being, see the Detailed release notes page.