Rename lessc->embeddedImages to lessc->embeddedFiles
authorOri Livneh <ori@wikimedia.org>
Mon, 23 Sep 2013 21:46:41 +0000 (14:46 -0700)
committerOri Livneh <ori@wikimedia.org>
Mon, 23 Sep 2013 21:46:41 +0000 (14:46 -0700)
'embeddedImages' is a custom property we set on lessc compiler instances to
track the set of files that were embedded in the generated source as data URIs.
This is so done so we know to regenerate the CSS if the source file for an
embedded asset changes. (If my pull request[1] is merged, we won't have to use
a custom property at all.)

I realized that the property name should be 'embeddedFiles' rather than
'embeddedImages', because it's not just images that can be usefully embedded in
CSS, but fonts as well.

  [1]: https://github.com/leafo/lessphp/pull/472

Change-Id: Ief3afaa23e4532f4a536e0dfef943d4fa20db80d

includes/DefaultSettings.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderModule.php

index 7a1eb22..46d1fd4 100644 (file)
@@ -3355,7 +3355,7 @@ $wgResourceLoaderLESSFunctions = array(
                $file = realpath( $base . '/' . $url );
 
                $data = CSSMin::encodeImageAsDataURI( $file );
-               $less->embeddedImages[ $file ] = filemtime( $file );
+               $less->embeddedFiles[ $file ] = filemtime( $file );
                return 'url(' . $data . ')';
        },
 );
index ead81cc..3b81b11 100644 (file)
@@ -772,9 +772,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                        $result['files'] = array( $fileName => self::safeFilemtime( $fileName ) );
                        $result['updated'] = time();
                }
-               // Tie cache expiry to the names and mtimes of image files that were
-               // embedded in the generated CSS source.
-               $result['files'] += $compiler->embeddedImages;
+               // Tie cache expiry to the names and mtimes of files that were embedded
+               // as data URIs in the generated CSS source.
+               $result['files'] += $compiler->embeddedFiles;
                $this->localFileRefs += array_keys( $result['files'] );
                $cache->set( $key, $result, $expire );
                return $result['compiled'];
index 226d91c..1119cdb 100644 (file)
@@ -470,10 +470,10 @@ abstract class ResourceLoaderModule {
                foreach ( $wgResourceLoaderLESSFunctions as $name => $func ) {
                        $less->registerFunction( $name, $func );
                }
-               // To ensure embedded images are refreshed when their source files
-               // change, track the names and modification times of image files that
-               // were embedded in the generated CSS source.
-               $less->embeddedImages = array();
+               // To ensure embedded resources are refreshed when their source files
+               // change, track the names and modification times of any files that
+               // were embedded as data URIs in the generated CSS source.
+               $less->embeddedFiles = array();
                return $less;
        }