PHamlP V3

PHamlP - the Haml and Sass extension - V3.0 is now available (download here).

Version 3 is fully compatible with Haml and Sass V3, and so brings some major updates - particularly to Sass - and is a recommended upgrade for all users.

  • Sass - Support for .sass (indented) and .scss (CSS style) syntaxes (note: the .sass syntax is not deprecated and will be fully supported

  • Sass - new syntax for variables and assignment:

$foo: 5


$bar: 10 !default

. !foo = 5 and !bar ||= 10 are deprecated and will generate a warning

  • Sass - @mixin and @include directives to define and use a mixin respectively. The ‘=’ and ‘+’ shortcuts are permitted in .sass files and are not deprecated; they are not allowed in .scss files

  • Sass - @extend directive allows selector inheritance by telling a selector to use the properties of another selector so keeping your page markup DRY.


.error {

  border: 1px #f00;

  background: #fdd;


.error.intrusion {

  font-size: 1.3em;

  font-weight: bold;


.badError {

  @extend .error;

  border-width: 3px;


CSS (note the selector re-writing to include .badError where ever .error is used)

.error, .badError {

  border: 1px #f00;

  background: #fdd;



.badError.intrusion {

  font-size: 1.3em;

  font-weight: bold;


.badError {

  border-width: 3px;


  • SassScript - full support for all SassScript functions. Particularly useful are the new colour handling functions that allow you to work in HSL.

Nesting of functions works as you would expect.


$my_bg_colour: #E6F2FF


  background: transparentize($my_bg_colour, 0.25)

  border: 5px solid transparentize(darken($my_bg_colour, 75%), 0.5)

  border-radius: 10px

  box-shadow: 10px 10px 5px #888

  margin: 1em

  • Sass - FireSass integration

  • Haml - HTML5 Custom Data Attributes

  • General - improved error reporting. Exceptions now give the location (filename and line number) of the error in the source and the source line


PHamlP is a port of Haml and Sass to PHP. All the genius comes from the people that invented and develop Sass; in particular:

  • Hampton Catlin

  • Nathan Weizenbaum

  • Chris Eppstein

The bugs are mine. Please report any found at

V3.1 is now available.

This adds support for SassNumbers with complex units, and @import can now import multiple files.

V3.2 is now available

This adds Compass as an extension to Sass.

It also fixes some SassScript parsing bugs, and HamlHelpers can now accept arrays as arguments.

I’m getting this error:

Undefined Variable: i: /Users/Hesedel/Sites/

Source: @while $i > 0

with this scss code:

@function whiten($color, $percent, $i: 1) {

	@while $i > 0 {

		$color: scale-color($color, $lightness: $percent);

		$i: $i - 1;


	@return $color;


It worked fine before I used this extension. Please help me.

How to use compass

I put this

@import compass/css3

in sass file, that doesn’t work