vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r21936: LJSUP-11897: System to organize JS/CSS s...

Committer: vad
LJSUP-11897: System to organize JS/CSS sources into libraries
U   trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2012-05-12 11:41:11 UTC (rev 21935)
+++ trunk/cgi-bin/weblib.pl	2012-05-12 11:51:42 UTC (rev 21936)
@@ -1341,11 +1341,6 @@
 
         die "Bogus reskey $reskey" unless $reskey =~ m!^(js|stc)/!;
 
-        ## is the key part of library/package
-        if (my $library = $LJ::JS_SOURCE_MAP_REV{$reskey}){
-            $reskey = $library;
-        }
-
         unless (exists $LJ::NEEDED_RES{$reskey}) {
             push @LJ::NEEDED_RES, $reskey;
         }
@@ -1626,6 +1621,21 @@
         $oldest{$type}{$condition}{$args} = $modtime if $modtime > $oldest{$type}{$condition}{$args};
     };
 
+    ## Replace sources with appropriate libraries
+    unless ($only_needed){
+        my %libs = ();
+        @LJ::NEEDED_RES = 
+            grep { length }
+            map  { 
+                my $res = $_;
+                ## is the key part of library/package
+                if (my $library = $LJ::JS_SOURCE_MAP_REV{$_}){
+                    $res = $library unless $libs{$library};
+                    $libs{$library}++;
+                } 
+                $res;
+            } @LJ::NEEDED_RES;
+    }
 
     foreach my $key (@LJ::NEEDED_RES) {
         my $path;

Tags: livejournal, pl, vad, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments