File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,3 +94,9 @@ output run this:
9494
9595For more help, run ` plessc --help `
9696
97+ ### This fork ([ nodge/lessphp] [ 5 ] )
98+
99+ The only change in this fork is the ability to change relative paths according to path to root .less file. (Fixes [ #119 ] [ 6 ] ).
100+
101+ [ 5 ] : https://github.com/Nodge/lessphp/
102+ [ 6 ] : https://github.com/leafo/lessphp/issues/119
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class lessc {
5252
5353 public $ importDisabled = false ;
5454 public $ importDir = '' ;
55-
55+
5656 public $ allowUrlRewrite = true ; // rewrite urls relative to imported files
5757 public $ baseUrlPath = null ;
5858
@@ -804,10 +804,14 @@ protected function rewriteUrls($url) {
804804
805805 if ($ baseImportDir === $ lastImportDir )
806806 return $ url ;
807-
807+
808+ $ arguments = null ;
809+ if (strpos ($ url ,'? ' ) !== false )
810+ list ($ url , $ arguments ) = explode ('? ' , $ url );
811+
808812 $ urlPath = realpath ($ lastImportDir .DIRECTORY_SEPARATOR .$ url );
809813 if ($ urlPath === false )
810- return $ url ;
814+ return $ arguments ? $ url . ' ? ' . $ arguments : $ url ;
811815
812816 $ baseArray = explode (DIRECTORY_SEPARATOR , $ baseImportDir );
813817 $ urlArray = explode (DIRECTORY_SEPARATOR , $ urlPath );
@@ -823,9 +827,9 @@ protected function rewriteUrls($url) {
823827 $ newUrl = str_repeat ('../ ' , count ($ baseArray ) - $ i );
824828 $ newUrl .= implode ('/ ' , array_slice ($ urlArray , $ i ));
825829
826- return $ newUrl ;
830+ return $ arguments ? $ newUrl . ' ? ' . $ arguments : $ newUrl ;
827831 }
828-
832+
829833 protected function lib_isnumber ($ value ) {
830834 return $ this ->toBool ($ value [0 ] == "number " );
831835 }
You can’t perform that action at this time.
0 commit comments