FileLoader
extends Plugin
in package
Table of Contents
- $limit : int
- $mimetype : string
- $name : string
- $test : string
- $compiler : mixed
- $encoded : array<string|int, mixed>
- __construct() : mixed
- Constructor, configure this object's options
- beforeCompile() : mixed
- Reset internal cache
- defineEvents() : array<string|int, mixed>
- Define new events
- extractAsset() : string|null
- Extract an asset
- init() : mixed
- Initialize plugin
- _extractAsset() : string
- Extract an asset, path is a known file here
- encodeBase64() : string|null
- Encode an image in base64 if the file is small enough
Properties
$limit
public
int
$limit
= 8192
Limit until where images will be encoded in base64 instead of exporting them, defaults to 8kb. 0 to disable
$mimetype
public
string
$mimetype
Force the Mimetype for the encoded files
$name
public
string
$name
= '[path][name].[ext]'
Name of the extracted files
$test
public
string
$test
Regular expression to match the file, the full path including query and fragment must be matched. example: '/.+.(?:ico|jpg|jpeg|png|gif)([?#].*)?$/'
$compiler
protected
mixed
$compiler
$encoded
protected
array<string|int, mixed>
$encoded
Encoded files cache
Methods
__construct()
Constructor, configure this object's options
public
__construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string|int, mixed> = []
Return values
mixed —beforeCompile()
Reset internal cache
public
beforeCompile(array<string|int, mixed> $files) : mixed
Parameters
- $files : array<string|int, mixed>
Return values
mixed —defineEvents()
Define new events
public
defineEvents() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —extractAsset()
Extract an asset
public
extractAsset(string $path) : string|null
Parameters
- $path : string
Return values
string|null —init()
Initialize plugin
public
init(Compiler $compiler) : mixed
Parameters
- $compiler : Compiler
Tags
Return values
mixed —_extractAsset()
Extract an asset, path is a known file here
protected
_extractAsset(string $path, string $suffix, string $relativeSrcFolder) : string
Parameters
- $path : string
- $suffix : string
- $relativeSrcFolder : string
Return values
string —encodeBase64()
Encode an image in base64 if the file is small enough
protected
encodeBase64(string $path) : string|null
Parameters
- $path : string