Commit | Line | Data |
---|---|---|
53ad55a5 MW |
1 | #! /usr/bin/perl |
2 | ||
3 | use autodie; | |
4 | use JSON; | |
5 | ||
6 | my ($dir) = @ARGV; | |
7 | mkdir $dir; | |
8 | ||
9 | local $/; | |
10 | my $js = decode_json <STDIN>; | |
11 | ||
12 | for my $e (@$js) { | |
13 | open $fh, ">", "$dir/$e->{name}.css"; | |
14 | print $fh "/* -*-css-*- */\n"; | |
15 | for my $s ($e->{sections}->@*) { | |
16 | KEY: for my $k (keys %$s) { | |
17 | next KEY if $k eq "code"; | |
18 | print $fh "/*@ $k: ", join(", ", $s->{$k}->@*), " */\n"; | |
19 | } | |
20 | print $fh $s->{code}, "\n"; | |
21 | print $fh "/*\@END*/\n"; | |
22 | } | |
23 | close $fh; | |
24 | } |