Re: [nanoc] question about constructing a folder structure

72 views
Skip to first unread message

Damien Pollet

unread,
May 9, 2013, 10:45:10 AM5/9/13
to na...@googlegroups.com
Quick on-the-fly untested answer:

route '/css/stylesheet/' do '/css/style.css' end


On 8 May 2013 17:29, Yaprak Ayazoglu <yaprak....@gmail.com> wrote:
Hi,

I'm trying to construct a folder structure for my website. 
For instance, suppose the have folder structure below

contents/css/stylesheet.css
contents/index.html 

And after I compile the project, I want the output folder be like:

output/css/style.css
output/index.html

I know that I have to define a rule for it. How can I write a rule for 
it?

Thanks.





--
--
You received this message because you are subscribed to the nanoc discusssion group.
 
To post to this group, send email to na...@googlegroups.com
To unsubscribe from this group, send email to
nanoc+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nanoc?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nanoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nanoc+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet

Tom Kenny

unread,
May 16, 2013, 11:40:21 PM5/16/13
to na...@googlegroups.com
http://nanoc.ws/docs/basics/#routing-the-item-representations - documentation on simple routing

In your Rules file, include:

route ''/css/stylesheet/' do 
  '/css/style.css'
end

route '/' do 
  '/index.html'
end

Some things to note: 

1. All item identifiers are wrapped in forward slashes ('/'), and have the extension omitted.

2. the identifier for the file 'index.html' at the *root* of the contents/ folder is just '/', not '/index/'. This is to allow you to write routing rules for, say, '/blog/' (blog.html) that automatically put the item in a folder of the same name and name the item 'index.html', which is the clean/standard way of naming markup files. See:

route '*' do
if item.binary?
# Write item with identifier /foo/ to /foo.ext
item.identifier.chop + '.' + item[:extension]
else
# every /item.html now goes to /item/index.html for clean URLs
item.identifier + 'index.html'
end
end



Reply all
Reply to author
Forward
0 new messages