Plack:...e::Sass(3pm)
π Plack::Middleware::File::Sass π
okay bestie, welcome to the Plack::Middleware::File::Sass page from the user-contributed Perl docs (yes, the manual name is literally Plack:...e::Sass(3pm), they really did abbreviate it like that, iconic). this one's all about Sass and SCSS support for all Plack frameworks. all of them. every single one. π¦
β¨ SYNOPSIS β¨
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/\.css$/, root => "./static";
like. look at that. two whole ways to serve your css and both of them eat. π
πΈ DESCRIPTION πΈ
Plack::Middleware::File::Sass is a Plack middleware component that teams up with Plack::App::File or Plack::Middleware::Static to compile Sass templates (that's http://sass-lang.com/ btw) into a CSS stylesheet on every single request. every one. no cap.
so here's the vibe check on how it actually works: when a request comes in asking for a .css file, this middleware quietly swaps the internal path over to .sass or .scss β whichever one your config says β in the same directory. if the Sass template is found, a brand new CSS stylesheet gets built on memory and served straight to the browsers. slay. otherwise? it just falls back to the original .css file sitting in that directory. no drama. π«Ά
this middleware is very handy for development, bestie. but listen β while Sass-to-CSS rendering is reasonably fast, for the production environment you might wanna precompile your Sass templates into CSS files on disk and serve them with a real web server like nginx or lighttpd. do it for the plot. π
π§ SASS BACKENDS π§
okay so here's the tea on backends, and there are rules:
- if you've got the sass gem at a version higher than 3 installed and the
sassexecutable is chillin' in yourPATH, this module automatically uses that command to convert Sass or SCSS into CSS. automatic. no config. it just knows. β¨ - if that command is not available and you've got the
Text::Sassperl module available instead, then that one gets used. π - and if neither is there? yeahhh, you'll get an exception during the initialization of this middleware component. π
π OPTIONS π
syntaxβ defines which syntax to use. valid values aresassandscss. defaults tosass. pick your fighter. π
π AUTHOR π
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
π LICENSE π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. periodt. π
β SEE ALSO β
Plack::App::FileText::Sass<http://sass-lang.com/>
and that's the whole page, bestie!! π this masterpiece is the Plack:...e::Sass(3pm) manual page, shipped with perl v5.34.0, dated 2022-06-16 β go forth and compile ur css, iykyk πβ¨π¦
π¦ where this page comes from
- debian bookworm: libplack-middleware-file-sass-perl 0.03-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libplack-middleware-file-sass-perl 0.03-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms