Sass middleware for Rackem

v0.2 2014-04-08 15:47 UTC


Rack'em middleware to serve SASS dynamically.


# config.php

// Rack up the middleware and you are good to go!
\Rackem::use_middleware(new \Rackem\Sass());

// or map to a specific path
\Rackem::map("/css", function($env) {
    $sass = new \Rackem\Sass\Environment();

    return $sass->call($env);


You can pass an options array() with the middleware, or to a Rackem\Sass\Enviroment instance.

Option Info Default
accepts File extensions used to locate sass source files (order matters). array("sass", "scss", "scss.css", "sass.css", "css")
paths Paths used to locate sass source files (order matters). array(".")
persist If true, will serve compiled css file directly. If source sass file is newer than compiled file, the sass will be re-compiled before being served. false
public Path used to write compiled css if persist option is true. getcwd()
parser Array of options passed into Sass\Parser. array("cache" => false)