[webgen-users] Haml & Sass

3 views
Skip to first unread message

mkoch

unread,
Sep 26, 2009, 8:34:34 PM9/26/09
to webgen...@rubyforge.org
I would like to use Haml for pages (and possibly templates) and Sass
for CSS. But I am a webgen newbie and can't figure out the
configuration. Is such a configuration possible? Could someone help me
set it up?
_______________________________________________
webgen-users mailing list
webgen...@rubyforge.org
http://rubyforge.org/mailman/listinfo/webgen-users

Thomas Leitner

unread,
Sep 27, 2009, 3:51:42 AM9/27/09
to webgen...@rubyforge.org, Leaf
> I would like to use Haml for pages (and possibly templates) and Sass
> for CSS. But I am a webgen newbie and can't figure out the
> configuration. Is such a configuration possible? Could someone help me
> set it up?

You need to put the following into your config.yaml file:

default_processing_pipeline:
Page: haml,fragments

Normally, the processing pipeline also includes erb, tags and blocks
tags, but I think they are not needed when using haml since haml
includes facilities to execute ruby commands (and tag results can still
be used through the context object as well as block rendering).

If you need to change the default for template files, just add another
entry with Template as key instead of Page.

If you want to use sass for your CSS files, just name them something
like default.sass.css. This will tell the copy handler that sass should
be run on the content before writing it to the output path.

If you need further help, don't hesitate to write again!

Best regars,
Thomas

Mick Koch

unread,
Sep 27, 2009, 10:52:41 AM9/27/09
to webgen...@rubyforge.org
Thank you for your help! I think I'm getting the hang of it now. Just
for future
reference, this is a bare bones setup:

config.yaml
===========
default_processing_pipeline:
Page: haml,fragments
Template: haml,fragments

default.template
================
!!! XML
!!! 1.1

%head
%link{:rel => "stylesheet", :type => "text/css", :href =>
"default.css"}
%title= context.node["title"]

%body
= context.render_block("content")

index.page
==========
---
title: A page
---

%h1 A heading

The resulting index.html
========================
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd">
<head>
<link href='default.css' rel='stylesheet' type='text/css' />
<title>A page</title>
</head>
<body>
<h1>A heading</h1>
</body>

> webgen-us...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/webgen-users

Thomas Leitner

unread,
Sep 28, 2009, 5:22:44 AM9/28/09
to webgen...@rubyforge.org
Am Sun, 27 Sep 2009 07:52:41 -0700 (PDT)
schrieb Mick Koch <kch...@gmail.com>:

> Thank you for your help! I think I'm getting the hang of it now. Just
> for future
> reference, this is a bare bones setup:
>
> config.yaml
> ===========
> default_processing_pipeline:
> Page: haml,fragments
> Template: haml,fragments
>

You only need to specify the fragments content processor once. If you
specify it for the page file, only headers of the page content itself
will be mapped to fragment nodes. If you specify it for templates, all
headers will be mapped to fragment nodes which may not be what you
want. Also note that only headers with IDs get mapped to fragment nodes.

-- Thomas
_______________________________________________
webgen-users mailing list
webgen...@rubyforge.org
http://rubyforge.org/mailman/listinfo/webgen-users

Testan

unread,
Sep 28, 2009, 5:48:04 PM9/28/09
to webgen...@rubyforge.org
On Sep 28, 5:22 am, Thomas Leitner <t_leit...@gmx.at> wrote:
> > config.yaml
> > ===========
> > default_processing_pipeline:
> > Page: haml,fragments
> > Template: haml,fragments
>
> You only need to specify the fragments content processor once. If you
> specify it for the page file, only headers of the page content itself
> will be mapped to fragment nodes. If you specify it for templates, all
> headers will be mapped to fragment nodes which may not be what you
> want. Also note that only headers with IDs get mapped to fragment nodes.

Ah, okay. Good to know.

Reply all
Reply to author
Forward
0 new messages