Methods
auditSelectors(css) → {Object|number|number}static
#
Given CSS source, count both the total number of selectors it contains and the number which match some element in the current document.
Parameters:
| Name | Type | Description |
|---|---|---|
css |
string | CSS source |
Returns:
-
Selector counts
- Type
- Object
-
return.selectors Total number of selectors
- Type
- number
-
return.matched Number of matched selectors
- Type
- number
- Source:
Given CSS source, count both the total number of selectors it contains and the number which match some element in the current document.
dumpTable(data)static
#
Print tabular data to the console using console.table.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Array | Tabular data represented as an array of objects with common properties. |
- Source:
getDependencyGraph() → {Object}static
#
Return a map of all dependency relationships between loaded modules.
Returns:
Maps module names to objects. Each sub-object has two properties, 'requires' and 'requiredBy'.
- Type
- Object
- Source:
getLoadedModules() → {Array}static
#
getModuleSize(moduleName) → {number|null}static
#
null}static
#
Calculate the byte size of a ResourceLoader module.
Parameters:
| Name | Type | Description |
|---|---|---|
moduleName |
string | The name of the module |
Returns:
Module size in bytes or null
- Type
-
number
|
null
- Source:
grep(pattern) → {Array}static
#
Perform a string search across the JavaScript and CSS source code of all loaded modules and return an array of the names of the modules that matched.
Parameters:
| Name | Type | Description |
|---|---|---|
pattern |
string | RegExp | String or regexp to match. |
Returns:
Array of the names of modules that matched.
- Type
- Array
- Source:
Perform a string search across the JavaScript and CSS source code of all loaded modules and return an array of the names of the modules that matched.
runReports([…reports])static
#
Generate and print reports.
When invoked without arguments, prints all available reports.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
reports |
string |
optional repeatable |
One or more of "size", "css", "store", or "time". |
- Source: