Rename lessc->embeddedImages to lessc->embeddedFiles

'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
This commit is contained in:
Ori Livneh 2013-09-23 14:46:41 -07:00
parent f14144aa74
commit 565b0fae81
3 changed files with 8 additions and 8 deletions

View 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 . ')';
},
);

View 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'];

View 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;
}