Utils
in package
Util functionalities.
Table of Contents
Methods
- getContentDir() : array<string|int, string>|false
- Get the content directory within `wp-content` and also ensure it is created.
- getContentUrl() : mixed
- Get the content directory URL.
- readFileAndCorrectSourceMap() : mixed
- Read a JavaScript file and update the sourceMappingUrl parameter in the file content to the correct one - it allows you to serve any file via any URL with the correct source map URL.
Methods
getContentDir()
Get the content directory within `wp-content` and also ensure it is created.
public
static getContentDir() : array<string|int, string>|false
Return values
array<string|int, string>|falsegetContentUrl()
Get the content directory URL.
public
static getContentUrl() : mixed
readFileAndCorrectSourceMap()
Read a JavaScript file and update the sourceMappingUrl parameter in the file content to the correct one - it allows you to serve any file via any URL with the correct source map URL.
public
static readFileAndCorrectSourceMap(string $path) : mixed
Parameters
- $path : string
-
The path to the original file (not the anonymous file!)