Committer: vad
LJSUP-11897: System to organize JS/CSS sources into librariesU 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;