dot/emacs, el/dot-emacs.el: Update browser configuration.
[profile] / firefox / explode-stylus
1 #! /usr/bin/perl
2
3 use autodie;
4 use POSIX qw{:errno_h};
5 use JSON;
6
7 my ($dir) = @ARGV;
8 eval { mkdir $dir; }; die if $@ && $@->errno != EEXIST;
9
10 local $/;
11 my $js = decode_json <STDIN>;
12
13 for my $e (@$js) {
14 open $fh, ">", "$dir/$e->{name}.css";
15 print $fh "/* -*-css-*- */\n";
16 for my $s ($e->{sections}->@*) {
17 KEY: for my $k (keys %$s) {
18 next KEY if $k eq "code";
19 print $fh "/*@ $k: ", join(", ", $s->{$k}->@*), " */\n";
20 }
21 $s->{code} =~ s/\n$//;
22 print $fh $s->{code}, "\n";
23 print $fh "/*\@END*/\n";
24 }
25 close $fh;
26 }