[webgen-users] webgen and less

Thomas Leitner t_leitner at gmx.at
Mon Nov 2 08:42:34 EST 2009


> 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.

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


More information about the webgen-users mailing list