| 1 |
NAME |
| 2 |
Plack::Middleware::File::Sass - Sass and SCSS support for all Plack |
| 3 |
frameworks |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
use Plack::App::File; |
| 7 |
use Plack::Builder; |
| 8 |
|
| 9 |
builder { |
| 10 |
mount "/stylesheets" => builder { |
| 11 |
enable "File::Sass"; |
| 12 |
Plack::App::File->new(root => "./stylesheets"); |
| 13 |
}; |
| 14 |
}; |
| 15 |
|
| 16 |
# Or with Middleware::Static |
| 17 |
enable "File::Sass", syntax => "scss"; |
| 18 |
enable "Static", path => qr/\.css$/, root => "./static"; |
| 19 |
|
| 20 |
DESCRIPTION |
| 21 |
Plack::Middleware::File::Sass is a Plack middleware component that works |
| 22 |
with Plack::App::File or Plack::Middleware::Static to compile Sass |
| 23 |
<http://sass-lang.com/> templates into CSS stylesheet in every request. |
| 24 |
|
| 25 |
When a request comes in for *.css* file, this middleware changes the |
| 26 |
internal path to *.sass* or *.scss*, depending on the configuration, in |
| 27 |
the same directory. If the Sass template is found, a new CSS stylesheet |
| 28 |
is built on memory and served to the browsers. Otherwise, it falls back |
| 29 |
to the original *.css* file in the directory. |
| 30 |
|
| 31 |
This middleware should be very handy for the development. While Sass to |
| 32 |
CSS rendering is reasonably fast, for the production environment you |
| 33 |
might want to precompile Sass templates to CSS files on disk and serves |
| 34 |
them with a real web server like nginx or lighttpd. |
| 35 |
|
| 36 |
SASS BACKENDS |
| 37 |
If you have the sass gem version higher than 3 installed and have the |
| 38 |
"sass" executable available in your PATH, this module automatically uses |
| 39 |
the command to convert Sass or SCSS into CSS. If the command is not |
| 40 |
available and you have Text::Sass perl module available, it will be |
| 41 |
used. Otherwise you'll get an exception during the initialization of |
| 42 |
this middleware component. |
| 43 |
|
| 44 |
OPTIONS |
| 45 |
syntax |
| 46 |
Defines which syntax to use. Valid values are *sass* and *scss*. |
| 47 |
Defaults to *sass*. |
| 48 |
|
| 49 |
AUTHOR |
| 50 |
Tatsuhiko Miyagawa <[email protected]> |
| 51 |
|
| 52 |
LICENSE |
| 53 |
This library is free software; you can redistribute it and/or modify it |
| 54 |
under the same terms as Perl itself. |
| 55 |
|
| 56 |
SEE ALSO |
| 57 |
Plack::App::File Text::Sass <http://sass-lang.com/> |
| 58 |
|