-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it always operate on a Bailador::App object
- Loading branch information
1 parent
d439d0c
commit 951de9f
Showing
3 changed files
with
13 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
unit class Bailador::Plugin::AssetPack::SASS:ver<1.001001>; | ||
unit class Bailador::Plugin::AssetPack::SASS:ver<2.001001>; | ||
|
||
use Bailador; | ||
|
||
method install { | ||
method install ($app) { | ||
my $sass = Proc::Async.new: 'sass', '--style', 'compressed', | ||
'--watch', $*SPEC.catdir('assets', 'sass'); | ||
|
||
$sass.stdout.tap: -> $v { $*OUT.print: $v }; | ||
$sass.stderr.tap: -> $v { $*ERR.print: $v }; | ||
$sass.start; | ||
|
||
get rx{ ^ '/assets/sass/' (.+) $ } => sub ($name) { | ||
$app.get: rx{ ^ '/assets/sass/' (.+) $ } => sub ($name) { | ||
my $file = $*SPEC.catdir('assets', 'sass', $name).IO; | ||
return status 404 unless .extension eq 'css' and .f and .r given $file; | ||
content_type 'text/css'; | ||
return $file.IO.slurp: :bin; | ||
return $app.response.code: 404 unless .extension eq 'css' and .f and .r given $file; | ||
$app.response.headers<Content-Type> = 'text/css'; | ||
$app.render: $file.IO.slurp: :bin; | ||
}; | ||
} |