Subversion Repositories wimsdev

Rev

Rev 6284 | Rev 7557 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #!/usr/bin/perl
  2.  
  3. use strict "vars";
  4. use strict "subs";
  5. use locale;
  6. use warnings;
  7. $/ = undef;
  8.  
  9. ##{
  10. ##  last if (/^$/);
  11. ##  if  (/^(.*)$/)   { $dir=$1 }
  12. ##} ;
  13.  
  14. my $char="---";
  15.  
  16. for my $f (glob("*/*.css.template")) {
  17.   my $f1= $f ; $f1 =~ s/.template// ; my $f2 = "$f1.tmp.css" ;
  18.   my $TEXT ="/*! generated form $f - do not modify directly */\n" ;
  19.   open(IN,"$f");
  20.   while (<IN> ) {
  21.    my $line=$_ ;
  22.    next if ($line =~ /^#/) ;
  23.    $line =~ s/--- (.*) ---/treate($1)/ge ;
  24.    $TEXT .= $line ;
  25.  }
  26.  close IN ;
  27.  $TEXT .= "\n";
  28.  out("$f2" ,$TEXT) ;
  29.  system("java -jar yuicompressor-2.4.7.jar $f2 -o $f1 -v; rm $f2");
  30. }
  31.  
  32.  
  33. sub treate { my ($c)= @_ ;
  34.   open(INN, $c);
  35.   my $text = <INN> ;
  36.   close(INN) ;
  37.   "\n/*! from $c */\n$text" ;
  38. } ;
  39.  
  40.  
  41.  
  42. sub out { my ($bloc, $text) = @_ ;
  43.   open  (OUT, ">$bloc") || warn "Creation du bloc $bloc impossible";
  44.   print OUT $text ; close OUT ;
  45. }