nanoc 和多种布局
是否可以对特定(或所有)项目使用多种布局? 例如,我有几个项目,我想对其应用两种不同的布局。一种具有绿色背景,一种具有蓝色背景(但是)。我想将它们编译到输出目录中的两个不同文件夹中(例如 v1 和 v2)。
我正在研究规则和编译块,但我不知道这是如何工作的。因为,每个项目在编译过程中只编译一次,所以我不能告诉nanoc第一次使用layout1编译它,第二次使用layout2编译它。我尝试过这样的操作,但它导致输出文件损坏。
compile '*' do
if item.binary?
# don’t filter binary items
else
filter :erb
layout 'layout1'
layout 'layout2'
end
end
希望我说清楚了,有人可以提供帮助。
谢谢, 无尾礼服
is it possible to use multiple layouts for a specific (or all) item(s)?
For example, I have a couple of items, and I want to apply two different layouts to it. One with a green and one with a blue background (however). And I want to compile them in two different folders in my output directory (e.g. v1 and v2).
I was playing with the rules and the compile blocks, but I couldn't figure out how this could work. Because, every item gets compiled only one time during the compile process, I can't tell nanoc to compile it the first time with layout1 and the second time with layout2. I tried sth like this, but it led to broken output files.
compile '*' do
if item.binary?
# don’t filter binary items
else
filter :erb
layout 'layout1'
layout 'layout2'
end
end
Hope I made myself clear and somebody can help.
thx,
tux
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
项目表示就是为了这个目的。您可以创建两种不同的表示形式,例如默认的表示形式和替代的表示形式,然后对它们应用编译和路由规则,如下所示:
Item representations are meant for this purpose. You can create two different representations, e.g. the default one and an alternative one, and then apply compilation and routing rules to them, like this: