Constructor
new SFCParser(sfcData)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
sfcData |
Class.<SFCData> | The class used to create the objects with the SFC parsed information. |
Methods
parse(contents, filepath, maxDepthopt) → {Promise.<?SFCData, Error>}
- Source:
Parses a SFC.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
contents |
string | The contents of the file. |
||
filepath |
string | The path of the file. |
||
maxDepth |
number |
<optional> |
0
|
How many components can be extended. For example, if a
file extends from one that extends from another and the
parameter is set to |
Returns:
If the file doesn't implement the <extend />
tag, the promise will resolve with null
.
- Type
- Promise.<?SFCData, Error>
(async) parseFromPath(filepath, maxDepthopt) → {Promise.<?SFCData, Error>}
- Source:
Parses a SFC by loading the file first; after the file is loaded, the method will
internally call SFCParser#parse
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filepath |
string | The path of the file. |
||
maxDepth |
number |
<optional> |
0
|
How many components can be extended. For example, if a
file extends from one that extends from another and the
parameter is set to |
Returns:
If the file doesn't implement the <extend />
tag, the promise will resolve with null
.
- Type
- Promise.<?SFCData, Error>