Plack:...e::Sass(3pm)

πŸ“¦
version 0.03 Β· 4 versions
, in debian bookworm, ubuntu noble

πŸ’– 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 sass executable is chillin' in your PATH, 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::Sass perl 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 are sass and scss. defaults to sass. 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 ⭐


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