Tuesday, March 29, 2011

Nanoc and No Compiling or Routing

Here's a short post on using nanoc with files that you just want copied from the content directory to the output directory unchanged. For these types of files, it's best if you have them in their own subdirectory (say images or css). Let's say we have some images (.jpg, .png, etc.). First just put them in an images directory under content. Then we need to add a couple of rules to our Rules files ...


compile '/images/*/' do
# Leave everything in the images directory as is.
end


and then a bit later on in the routing section ...


route '/images/*/' do
# Make sure that /images/some_image/ is routed to
# /images/some_image.jpg or /images/some_image.png or so
item.identifier.chop + '.' + item[:extension]
end


I didn't do an actual project and put it up on GitHub for this one, but if this isn't clear, then let me know and I can do that too.

No comments:

Post a Comment