Skip to content

Commit

Permalink
Optionally use sassc
Browse files Browse the repository at this point in the history
ruby's sass is officially abandoned, and it has problems with some css files,
for example the latest bootstrap css, so it would be good to have the option
to use sassc. Or even other sass implementations.

This PR will use sassc if `MOJO_PLUGIN_ASSETPACK_SASSC` is set.
  • Loading branch information
perlpunk committed Jun 18, 2024
1 parent 9839a51 commit 29d01c4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ sub process {
$asset->content($store->save(\$css, $attrs))->FROM_JSON($attrs);
}
else {
my @args = (qw(sass -s), map { ('-I', $_) } @{$opts{include_paths}});
push @args, '--scss' if $asset->format eq 'scss';
push @args, qw(-t compressed) if $attrs->{minified};
my @args;
if ($ENV{MOJO_PLUGIN_ASSETPACK_SASSC}) {
@args = (qw(sassc -s), map { ('-I', $_) } @{$opts{include_paths}});
}
else {
@args = (qw(sass -s --trace), map { ('-I', $_) } @{$opts{include_paths}});
push @args, '--scss' if $asset->format eq 'scss';
push @args, qw(-t compressed) if $attrs->{minified};
}
$self->run(\@args, \$content, \my $css, undef);
$asset->content($store->save(\$css, $attrs))->FROM_JSON($attrs);
}
Expand Down

0 comments on commit 29d01c4

Please sign in to comment.