I'm new to webgen, and I like what I see so far, but I have been
trying to understand the webgen dir structure and extension scheme so
that I could make use of less (http://lesscss.org/) to generate css
files (in the way that sass is currently supported). However I seem to
be going in circles, so perhaps someone can give me some pointers.
I would like to be able to write less formatted css files in the src
folder called for example: src/default.less.css, then after running
webgen on that I would like that to be processed through the less
parser, with the output being placed in the out folder and renamed as:
out/default.css.
So I assume that I need to write an extension to support this, but I'm
not clear on how to configure webgen so that it maps the css files to
be processed via my custom extension.
Any pointers would be appreciated.
thanks
Sam
_______________________________________________
webgen-users mailing list
webgen...@rubyforge.org
http://rubyforge.org/mailman/listinfo/webgen-users
The naming of the file is correct. However, the problem is the missing
less content processor. Put the following into the ext/init.rb file
and using less should work:
class LessProcessor
def call(context)
require 'less'
context.content = Less.parse(context.content)
context
end
end
Webgen::WebsiteAccess.website.config['contentprocessor.map']['less'] = 'LessProcessor'
After that, any file that has .less.css is run through the less parser
and put into an .css output file.
*hth*,
Thomas
I was nearly there, I had a LessProcessor class pretty much exactly as
you've given, but hadn't quite understood that just the simple
association of the content processor class with the 'less' name in
init.rb was enough to hook it up (also I had the LessProcessor in a
separate file under ext/ and was trying to require it from init.rb,
but perhaps that's unnecessary for a simple case like this).
thanks for the quick response.
Sam
2009/11/2 Thomas Leitner <t_le...@gmx.at>: