MediaWiki REL1_39
MediaWiki\ResourceLoader\VueComponentParser Class Reference

Parser for Vue single file components (.vue files). More...

Public Member Functions

 parse (string $html, array $options=[])
 Parse a Vue single file component, and extract the script, template and style parts.
 

Detailed Description

Parser for Vue single file components (.vue files).

See parse() for usage.

Access: internal
For use within FileModule.

Definition at line 46 of file VueComponentParser.php.

Member Function Documentation

◆ parse()

MediaWiki\ResourceLoader\VueComponentParser::parse ( string $html,
array $options = [] )

Parse a Vue single file component, and extract the script, template and style parts.

Returns an associative array with the following keys:

  • 'script': The JS code in the <script> tag
  • 'template': The HTML in the <template> tag
  • 'style': The CSS/LESS styles in the <style> tag, or null if the <style> tag was missing
  • 'styleLang': The language used for 'style'; either 'css' or 'less', or null if no <style> tag

The following options can be passed in the $options parameter:

  • 'minifyTemplate': Whether to minify the HTML in the template tag. This removes HTML comments and strips whitespace. Default: false
Parameters
string$htmlHTML with <script>, <template> and <style> tags at the top level
array$optionsAssociative array of options
Returns
array
Exceptions
ExceptionIf the input is invalid

Definition at line 65 of file VueComponentParser.php.


The documentation for this class was generated from the following file: