Bundle
in package
Utility class for creating cache bundles of styles and scripts.
Table of Contents
Methods
- Automate() : string
- Automates the process of bundling scripts and styles.
- Compile() : string
- Compiles scripts and styles.
- CompileFiles() : string
- Compiles scripts and styles from specified files.
- Export() : mixed
- Exports the compiled bundle.
- GetChildAssets() : array<string|int, mixed>
- Retrieves child assets.
- GetNamespaceAssets() : array<string|int, mixed>
- Retrieves assets from namespaces.
- LastModified() : int
- Retrieves the last modified timestamp of the bundle.
Methods
Automate()
Automates the process of bundling scripts and styles.
public
static Automate(string $domain, string $name, string $ext, array<string|int, mixed> $ar[, string|null $useDomainsInUrls = null ]) : string
Parameters
- $domain : string
-
The domain name
- $name : string
-
The name of the bundle
- $ext : string
-
The file extension to include
- $ar : array<string|int, mixed>
-
Array of settings for bundling assets
- $useDomainsInUrls : string|null = null
-
The domain to use in URLs
Return values
string —The path to the compiled bundle
Compile()
Compiles scripts and styles.
public
static Compile(string $name, array<string|int, mixed> $exts, string $path[, array<string|int, mixed> $exception = array() ][, bool $preg = false ][, bool $returnContent = false ]) : string
Parameters
- $name : string
-
The name of the bundle
- $exts : array<string|int, mixed>
-
File extensions to include
- $path : string
-
The path to search for assets
- $exception : array<string|int, mixed> = array()
-
Directories to exclude from the search
- $preg : bool = false
-
Use regular expressions in the search
- $returnContent : bool = false
-
Whether to return the compiled content instead of writing to a file
Return values
string —The path to the compiled bundle
CompileFiles()
Compiles scripts and styles from specified files.
public
static CompileFiles(string $name, array<string|int, mixed> $exts, array<string|int, mixed> $files[, bool $returnContent = false ]) : string
Parameters
- $name : string
-
The name of the bundle
- $exts : array<string|int, mixed>
-
File extensions to include
- $files : array<string|int, mixed>
-
Array of file paths to compile
- $returnContent : bool = false
-
Whether to return the compiled content instead of writing to a file
Return values
string —The path to the compiled bundle
Export()
Exports the compiled bundle.
public
static Export(string $domain, string $ext, string $name, string $content) : mixed
Parameters
- $domain : string
-
The domain name
- $ext : string
-
The file extension
- $name : string
-
The name of the bundle
- $content : string
-
The compiled content
GetChildAssets()
Retrieves child assets.
public
static GetChildAssets(string $path, array<string|int, mixed> $exts[, array<string|int, mixed> $exception = [] ][, bool $preg = false ]) : array<string|int, mixed>
Parameters
- $path : string
-
The path to search for assets
- $exts : array<string|int, mixed>
-
File extensions to include
- $exception : array<string|int, mixed> = []
-
Directories to exclude from the search
- $preg : bool = false
-
Use regular expressions in the search
Return values
array<string|int, mixed> —Array of asset file paths
GetNamespaceAssets()
Retrieves assets from namespaces.
public
static GetNamespaceAssets(string $path, array<string|int, mixed> $exts[, array<string|int, mixed> $exception = [] ][, bool $preg = false ]) : array<string|int, mixed>
Parameters
- $path : string
-
The path to search for assets
- $exts : array<string|int, mixed>
-
File extensions to include
- $exception : array<string|int, mixed> = []
-
Directories to exclude from the search
- $preg : bool = false
-
Use regular expressions in the search
Return values
array<string|int, mixed> —Array of asset file paths
LastModified()
Retrieves the last modified timestamp of the bundle.
public
static LastModified(string $name, array<string|int, mixed> $exts, string $path[, array<string|int, mixed> $exception = array() ][, bool $preg = false ]) : int
Parameters
- $name : string
-
The name of the bundle
- $exts : array<string|int, mixed>
-
File extensions to include
- $path : string
-
The path to search for assets
- $exception : array<string|int, mixed> = array()
-
Directories to exclude from the search
- $preg : bool = false
-
Use regular expressions in the search
Return values
int —The last modified timestamp