MediaWiki  1.23.0
ResourceLoaderLESSFunctions Class Reference

Static Public Member Functions

static embed ( $frame, $less)
 Convert an image URI to a base64-encoded data URI. More...
 
static embeddable ( $frame, $less)
 Check if an image file reference is suitable for embedding. More...
 

Detailed Description

Definition at line 23 of file ResourceLoaderLESSFunctions.php.

Member Function Documentation

◆ embed()

static ResourceLoaderLESSFunctions::embed (   $frame,
  $less 
)
static

Convert an image URI to a base64-encoded data URI.

Example:
.fancy-button {
background-image: embed('../images/button-bg.png');
}

Definition at line 58 of file ResourceLoaderLESSFunctions.php.

References $file, and CSSMin\encodeImageAsDataURI().

◆ embeddable()

static ResourceLoaderLESSFunctions::embeddable (   $frame,
  $less 
)
static

Check if an image file reference is suitable for embedding.

An image is embeddable if it (a) exists, (b) has a suitable MIME-type, (c) does not exceed IE<9 size limit of 32kb. This is a LESS predicate function; it returns a LESS boolean value and can thus be used as a mixin guard.

Example:
.background-image(@url) when(embeddable(@url)) {
background-image: url(@url) !ie;
}

Definition at line 38 of file ResourceLoaderLESSFunctions.php.

References $file, CSSMin\EMBED_SIZE_LIMIT, and CSSMin\getMimeType().


The documentation for this class was generated from the following file:
ResourceLoaderLESSFunctions\embeddable
static embeddable( $frame, $less)
Check if an image file reference is suitable for embedding.
Definition: ResourceLoaderLESSFunctions.php:38
ResourceLoaderLESSFunctions\embed
static embed( $frame, $less)
Convert an image URI to a base64-encoded data URI.
Definition: ResourceLoaderLESSFunctions.php:58