[Rt-commit] r5525 - in CSS-Squish: lib/CSS t t/css t/css3

trs at bestpractical.com trs at bestpractical.com
Tue Jul 4 15:04:26 EDT 2006


Author: trs
Date: Tue Jul  4 15:04:25 2006
New Revision: 5525

Added:
   CSS-Squish/t/css/07-basic-extra-roots3.css
   CSS-Squish/t/css/07-basic-extra-roots4.css
   CSS-Squish/t/css3/
   CSS-Squish/t/css3/07-basic-extra-roots3.css
Modified:
   CSS-Squish/   (props changed)
   CSS-Squish/MANIFEST
   CSS-Squish/README
   CSS-Squish/lib/CSS/Squish.pm
   CSS-Squish/t/07-basic-extra-roots.t
   CSS-Squish/t/css/07-basic-extra-roots.css

Log:
 r13913 at zot:  tom | 2006-07-04 14:59:49 -0400
 * CSS::Squish now searches the user-specified roots before looking relative to the importing file
 * Add a few more tests of the multi-root import
 * Update manifest and readme


Modified: CSS-Squish/MANIFEST
==============================================================================
--- CSS-Squish/MANIFEST	(original)
+++ CSS-Squish/MANIFEST	Tue Jul  4 15:04:25 2006
@@ -22,9 +22,12 @@
 t/css/05-loop-prevention-3.css
 t/css/05-loop-prevention.css
 t/css/07-basic-extra-roots.css
+t/css/07-basic-extra-roots3.css
+t/css/07-basic-extra-roots4.css
 t/css/blam.css
 t/css/foo.css
 t/css/foo/04-recursion-2.css
 t/css/foo/04-recursion-3.css
 t/css/foo2.css
 t/css2/07-basic-extra-roots2.css
+t/css3/07-basic-extra-roots3.css

Modified: CSS-Squish/README
==============================================================================
--- CSS-Squish/README	(original)
+++ CSS-Squish/README	Tue Jul  4 15:04:25 2006
@@ -28,6 +28,14 @@
     Takes a filehandle to print to and a list of files to concatenate.
     "concatenate" uses this method with an "open"ed scalar.
 
+  CSS::Squish->roots(@dirs)
+    A getter/setter for additional paths to search when looking for imported
+    files. The paths specified here are searched _before_ trying to find the
+    import relative to the file from which it is imported. This is useful if
+    your server has multiple document roots from which your CSS imports
+    files and lets you override the default behaviour (but still fall back
+    to it).
+
 BUGS AND SHORTCOMINGS
     At the current time, comments are not skipped. This means comments
     happening before @import statements at the top of a file will cause the

Modified: CSS-Squish/lib/CSS/Squish.pm
==============================================================================
--- CSS-Squish/lib/CSS/Squish.pm	(original)
+++ CSS-Squish/lib/CSS/Squish.pm	Tue Jul  4 15:04:25 2006
@@ -3,7 +3,7 @@
 
 package CSS::Squish;
 
-$CSS::Squish::VERSION = '0.04';
+$CSS::Squish::VERSION = '0.05';
 
 # Setting this to true will enable lots of debug logging about what
 # CSS::Squish is doing
@@ -133,12 +133,13 @@
                 # We need the path relative to where we're importing it from
                 my @spec = File::Spec->splitpath( $file );
 
-                # This first searches for the import relative to the file
-                # it is imported from and then in any user-specified roots
+                # This first searches any user-specified roots for the
+                # imported file and if that fails, tries to find it
+                # relative to the importing file
                 my $import_path = $self->_resolve_file(
                                         $import,
+                                        $self->roots,
                                         File::Spec->catpath( @spec[0,1], '' ),
-                                        $self->roots
                                   );
 
                 if ( not defined $import_path ) {
@@ -186,9 +187,10 @@
 =head2 B<CSS::Squish-E<gt>roots(@dirs)>
 
 A getter/setter for additional paths to search when looking for imported
-files.  The paths specified here are searched after trying to find the import
-relative to the file from which it is imported.  This is useful if your
-server has multiple document roots from which your CSS imports files.
+files.  The paths specified here are searched _before_ trying to find the
+import relative to the file from which it is imported.  This is useful if
+your server has multiple document roots from which your CSS imports files
+and lets you override the default behaviour (but still fall back to it).
 
 =cut
 

Modified: CSS-Squish/t/07-basic-extra-roots.t
==============================================================================
--- CSS-Squish/t/07-basic-extra-roots.t	(original)
+++ CSS-Squish/t/07-basic-extra-roots.t	Tue Jul  4 15:04:25 2006
@@ -18,11 +18,29 @@
 
 /** End of 07-basic-extra-roots2.css */
 
+
+/**
+  * From t/css/07-basic-extra-roots.css: @import "07-basic-extra-roots3.css";
+  */
+
+foobaz
+
+/** End of 07-basic-extra-roots3.css */
+
+
+/**
+  * From t/css/07-basic-extra-roots.css: @import "07-basic-extra-roots4.css";
+  */
+
+fallback
+
+/** End of 07-basic-extra-roots4.css */
+
 blam
 
 EOT
 
-CSS::Squish->roots( 't/css2/' );
+CSS::Squish->roots( 't/css2/', 't/css3/' );
 my $result = CSS::Squish->concatenate('t/css/07-basic-extra-roots.css');
 
 is_string($result, $expected_result, "Basic extra roots");

Modified: CSS-Squish/t/css/07-basic-extra-roots.css
==============================================================================
--- CSS-Squish/t/css/07-basic-extra-roots.css	(original)
+++ CSS-Squish/t/css/07-basic-extra-roots.css	Tue Jul  4 15:04:25 2006
@@ -1,4 +1,6 @@
 
 @import "07-basic-extra-roots2.css";
+ at import "07-basic-extra-roots3.css";
+ at import "07-basic-extra-roots4.css";
 blam
 

Added: CSS-Squish/t/css/07-basic-extra-roots3.css
==============================================================================
--- (empty file)
+++ CSS-Squish/t/css/07-basic-extra-roots3.css	Tue Jul  4 15:04:25 2006
@@ -0,0 +1 @@
+notthis

Added: CSS-Squish/t/css/07-basic-extra-roots4.css
==============================================================================
--- (empty file)
+++ CSS-Squish/t/css/07-basic-extra-roots4.css	Tue Jul  4 15:04:25 2006
@@ -0,0 +1 @@
+fallback

Added: CSS-Squish/t/css3/07-basic-extra-roots3.css
==============================================================================
--- (empty file)
+++ CSS-Squish/t/css3/07-basic-extra-roots3.css	Tue Jul  4 15:04:25 2006
@@ -0,0 +1 @@
+foobaz


More information about the Rt-commit mailing list