Richard Hart

Head of Something @ Somewhere
Kent, UK

My Music
My Photos

LinkedIn
Mastodon

Using SCSS with Webby

To get webby using HAML/SASS’ SCSS rendering engine I added the following to my Sitefile. No doubt there’s a cleaner and quicker way of getting it working, but this works.

  Webby::Filters.register :scss do |input, cursor|
    opts = ::Webby.site.sass_options.merge(cursor.page.sass_options || {})
    opts = ::Webby.site.sass_options.merge(:syntax => :scss)
    opts = opts.symbolize_keys
    opts.merge!(:filename => cursor.page.destination)
    opts[:style] = opts[:style].to_sym if opts.include? :style
    Sass::Engine.new(input, opts).render
  end