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
and
$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.
SCSS
.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;
}
.error.intrusion,
.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.
SASS
$my_bg_colour: #E6F2FF
#yw1
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
Credits
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 http://code.google.com/p/phamlp/issues/list