vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r22961: LJSUP-13771: Create method to add multip...

Committer: vad
LJSUP-13771: Create method to add multiple resources (css/js/templates/ml) to page in one call
U   trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2012-09-24 14:41:04 UTC (rev 22960)
+++ trunk/cgi-bin/weblib.pl	2012-09-24 15:08:33 UTC (rev 22961)
@@ -1311,7 +1311,27 @@
     return $LJ::STATPREFIX . $url . "?v=" . $mtime;
 }
 
+sub need_res_group {
+    my (@groupnames) = @_;
+    foreach my $name (@groupnames){
+        my $group = $LJ::RES_GROUP_DEPS{$name};
+        next unless $group;
 
+        ## js, css, templates
+        foreach my $resource_class (qw/js css templates/){
+            next unless exists $group->{$resource_class};
+            foreach my $files ($group->{$resource_class}){
+                LJ::need_res($_) for @$files;
+            }
+        }
+
+        ## ml
+        if (my $mls = $group->{ml}){
+            LJ::need_string(@$mls);
+        }
+    }
+}
+
 ## Support for conditional file inclusion:
 ## e.g. LJ::need_res( {condition => 'IE'}, 'ie.css', 'myie.css') will result in
 ## <!--[if IE]><link rel="stylesheet" type="text/css" href="$statprefix/..." /><![endif]-->

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