.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Plack::Middleware::File::Sass 3pm" .TH Plack::Middleware::File::Sass 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Plack::Middleware::File::Sass \- Sass and SCSS support for all Plack frameworks .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Plack::App::File; \& use Plack::Builder; \& \& builder { \& mount "/stylesheets" => builder { \& enable "File::Sass"; \& Plack::App::File\->new(root => "./stylesheets"); \& }; \& }; \& \& # Or with Middleware::Static \& enable "File::Sass", syntax => "scss"; \& enable "Static", path => qr/\e.css$/, root => "./static"; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Plack::Middleware::File::Sass is a Plack middleware component that works with Plack::App::File or Plack::Middleware::Static to compile Sass templates into CSS stylesheet in every request. .PP When a request comes in for \fI.css\fR file, this middleware changes the internal path to \fI.sass\fR or \fI.scss\fR, depending on the configuration, in the same directory. If the Sass template is found, a new CSS stylesheet is built on memory and served to the browsers. Otherwise, it falls back to the original \fI.css\fR file in the directory. .PP This middleware should be very handy for the development. While Sass to CSS rendering is reasonably fast, for the production environment you might want to precompile Sass templates to CSS files on disk and serves them with a real web server like nginx or lighttpd. .SH "SASS BACKENDS" .IX Header "SASS BACKENDS" If you have the sass gem version higher than 3 installed and have the \&\f(CW\*(C`sass\*(C'\fR executable available in your PATH, this module automatically uses the command to convert Sass or SCSS into CSS. If the command is not available and you have Text::Sass perl module available, it will be used. Otherwise you'll get an exception during the initialization of this middleware component. .SH OPTIONS .IX Header "OPTIONS" .IP syntax 4 .IX Item "syntax" Defines which syntax to use. Valid values are \fIsass\fR and \&\fIscss\fR. Defaults to \fIsass\fR. .SH AUTHOR .IX Header "AUTHOR" Tatsuhiko Miyagawa .SH LICENSE .IX Header "LICENSE" This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Plack::App::File Text::Sass