Project

haml-more

0.01
No commit activity in last 3 years
No release in over 3 years
Adds more functionality to Haml and Sass (part of BigBand).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.3.0

Runtime

>= 2.2.20
~> 0.5.2
 Project Readme

Haml::More and Sass::More

Adds more functionality to Haml and Sass. Haml helpers detect if called from another context, so they are usable with Erb and friends.

BigBand

Haml::More and Sass::More are part of the BigBand stack. Check it out if you are looking for fancy Sinatra extensions.

Haml extensions

  • content_for and yield_content (like in Rails, you know?)

      // some_file.haml
      = yield_content(:foo)
      .content
        = haml :another_file
      
      // another_file.haml
      - content_for(:foo)
        %b bar
      .something
        %h1 cool, huh?
    
  • adds :coffee_script for inline CoffeeScript

      %head
        %title CoffeScript example
        :coffee_script
          if happy and knows_it
            claps_hands()
            cha_cha_cha()
      %body
        content
    

SassScript extensions

  • min and max

      .someClass
        width = max(100px, !someSize * 3)
        height = min(!a, !b, 20%)
    

Usage with Sinatra

Classic style:

require "sinatra"
require "haml/more"

Modular:

require "sinatra/base"
require "haml/more"

class Foo < Sinatra::Base
  helpers Haml::More
end

Usage without Sinatra

Using just Sass::More (if you're in Merb or Rails):

# in some initializer or something
require "sass/more"

Without anything:

require "haml/more"
scope = Object.new
scope.extend Haml::More
puts Haml::Engine.new("%p some haml code").render(scope)