[Bps-public-commit] r11962 - in HTML-RewriteAttributes: lib/HTML/RewriteAttributes

sartak at bestpractical.com sartak at bestpractical.com
Tue Apr 29 18:15:45 EDT 2008


Author: sartak
Date: Tue Apr 29 18:15:44 2008
New Revision: 11962

Modified:
   HTML-RewriteAttributes/   (props changed)
   HTML-RewriteAttributes/lib/HTML/RewriteAttributes/Resources.pm

Log:
 r54667 at onn:  sartak | 2008-04-29 18:09:47 -0400
 Closer, just not handling @imports in <style type="text/css">...</style> yet


Modified: HTML-RewriteAttributes/lib/HTML/RewriteAttributes/Resources.pm
==============================================================================
--- HTML-RewriteAttributes/lib/HTML/RewriteAttributes/Resources.pm	(original)
+++ HTML-RewriteAttributes/lib/HTML/RewriteAttributes/Resources.pm	Tue Apr 29 18:15:44 2008
@@ -73,8 +73,21 @@
     my $self    = shift;
     my $content = shift;
     return $content if !$self->{rewrite_inline_imports};
+
+    # repeat until we get no substitutions
+    1 while $content =~ s{\@import\s*"([^"]+)"\s*;}{ $self->_import($1) }eg;
+
     return $content;
 }
 
+sub _import {
+    my $self = shift;
+    my $uri  = shift;
+
+    return '' if $self->{rewrite_inline_imports_seen}{$uri}++;
+
+    return $self->{rewrite_inline_css_cb}->($uri);
+}
+
 1;
 



More information about the Bps-public-commit mailing list