<denis.defre
...@stoneship.org> wrote:
> On 30 Sep 2008, at 05:10, ics.lifem...@gmail.com wrote:
>> I am new to web page development. I have been able to use Nanoc to
>> build my first web site, but am having trouble with assets. [..]
>> Could someone give me a hand in how assets are used?
> Hi,
> Assets are very similar to pages. A page consists of a directory with
> a content and a meta file, and so does an asset. So, if you have a
> file named "mycoolpicture.png" and you want to make it an asset, you
> put it into a directory named "mycoolpicture" inside the "assets"
> directory, along with a file named "mycoolpicture.yaml".
> The YAML meta file can contain two attributes: "binary", which is true
> or false depending on whether it's a textual asset or not (which
> determines the kind of filters you can use on it), and "filters",
> which is a list of filters to run on the asset.
> A really quick example:
> ~% nanoc cs assets_test
> ~% cd assets_test
> ~/assets_test% mkdir assets/mycoolpicture
> ~/assets_test% touch assets/mycoolpicture/mycoolpicture.yaml
> ~/assets_test% cp ~/somepic.png assets/mycoolpicture/mycoolpicture.png
> If you only want to copy the file from the assets directory into the
> output directory, set binary to true and make sure the list of filters
> is empty, like this:
> # Just copy it to the output directory
> filters: []
> # This is a binary file, not a textual file
> binary: true
> And of course you can then compile the site:
> ~/assets_test% nanoc co
> Compiling site...
> create [0.00s] output/index.html
> create [0.01s] output/assets/mycoolpicture.png
> Site compiled in 0.02s.
> If you don't filter an asset, though, it may be faster to simply
> directly store the assets in the output directory. Copying an asset
> from assets/ to output/ takes time, especially when it's large (and
> filtering an asset takes even longer) so this will result in a speed-
> up. Just make sure you don't accidentally delete everything in the
> output directory then. :)
> Hope this helps!
> Denis
> --
> Denis Defreyne
> denis.defre...@stoneship.org