Skip to content

Commit d904906

Browse files
committed
Add and enable libsass image size plugin
1 parent 1cdc831 commit d904906

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "plugins/digest"]
1717
path = plugins/digest
1818
url = https://github.com/mgreter/libsass-digest
19+
[submodule "plugins/img-size"]
20+
path = plugins/img-size
21+
url = https://github.com/mgreter/libsass-img-size

Makefile.PL

+23
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ if ($install_sassc) {
175175
if ($install_plugins) {
176176
# add optional libsass-math plugin
177177
push @submodules, "plugins/math";
178+
# add optional libsass-img-size plugin
179+
push @submodules, "plugins/img-size";
178180
# add optional libsass-glob plugin
179181
push @incs, 'plugins/glob/vendor';
180182
push @submodules, "plugins/glob";
@@ -600,6 +602,26 @@ sub libsass_plugin_math
600602
return join "\n", @ret;
601603
}
602604

605+
sub libsass_plugin_img_size
606+
{
607+
my @ret = 'IMG_SIZE_OBJ = plugins/img-size/src/img-size$(OBJ_EXT)';
608+
# location of the created object
609+
push @ret, 'IMG_SIZE_LIB = $(INST_ARCHAUTODIR)/plugins/img-size/img-size.$(SO)';
610+
# create the target for the makefile
611+
push @ret, '$(IMG_SIZE_LIB): $(LIBSASS_LIB) $(IMG_SIZE_OBJ)';
612+
# make sure the plugin path exists for output
613+
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/img-size';
614+
# create the libsass shared library by linking against all objects
615+
push @ret, "\t" . compile_lib('$(IMG_SIZE_LIB)') . ' $(IMG_SIZE_OBJ)'
616+
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_LIB) -lsass');
617+
# add target to virtual "pure_all"
618+
push @cleanups, '$(IMG_SIZE_OBJ)';
619+
push @cleanups, '$(IMG_SIZE_LIB)';
620+
push @targets, '$(IMG_SIZE_LIB)';
621+
# return makefile part
622+
return join "\n", @ret;
623+
}
624+
603625
sub libsass_plugin_digest
604626
{
605627
my @ret = 'DIGEST_OBJ = ' . join' ',
@@ -670,6 +692,7 @@ sub runOnce
670692
if ($install_plugins) {
671693
push @commands, '', libsass_plugin_glob();
672694
push @commands, '', libsass_plugin_math();
695+
push @commands, '', libsass_plugin_img_size();
673696
# needs a few C-API changes not yet released
674697
# push @commands, '', libsass_plugin_digest();
675698
}

lib/CSS/Sass/Plugins.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ return \%plugins unless -d $root;
4747
opendir (my $dh, $root) or
4848
die "error querying plugins";
4949
while (my $item = readdir($dh)) {
50-
next unless $item =~ m/^[a-zA-Z]+$/;
50+
next unless $item =~ m/^[a-zA-Z\-]+$/;
5151
$plugins{$item} = $root . $item
5252
}
5353

plugins/img-size

Submodule img-size added at 55826d1

0 commit comments

Comments
 (0)