Repository navigation
processLocalAssets
Parses HTML content for local image (<img>) and stylesheet (<link>) assets, resolves their paths relative to the source directory, recreates subfolder directory structures, and copies missing asset files into the output directory.
📌 This method is private and executes internally by endCode() when static asset copying is enabled.
processLocalAssets(string $htmlContent): void
htmlContent (string) : The fully transformed HTML string generated during the buffer process.
-
Asset Extraction: Matches local asset references using
self::IMGSRCREGEX(image sources) andself::LINKHREFREGEX(stylesheet links). -
Filtering External Links: Filters out external protocol links (
http://,https://), protocol-relative paths (//), inline data URIs (data:), and patterns matchingself::EXTSRCREGEX. -
Path Normalization: Strips query strings, removes relative directory indicators (
./and../), and resolves local source file paths against$this->path. -
Directory Structure Preservation: Recreates the exact original directory structure (e.g.,
assets/images/,assets/css/) inside$this->outputPath. -
File Transfer: Copies files from source to destination if they do not already exist in the output directory.
(void) : This method does not return a value.
| Config Key | Default Value | Allowed Values | Description |
|---|---|---|---|
| copyAssets | true | bool | Copy local assets when using endCode(). |
- No debug errors.