File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ class HTMLValidatePlugin {
77 {
88 // default values
99 path : 'src/**/*' ,
10- extensions : [ 'html' ] ,
11- config : false ,
10+ extensions : 'html' ,
11+ config : '.htmlvalidate' ,
1212 global : false ,
1313 } ,
1414 ( {
@@ -22,6 +22,14 @@ class HTMLValidatePlugin {
2222 ) ;
2323 }
2424
25+ getExtensions ( ) {
26+ return this . extensions === 'html' ? this . extensions : this . convertExtensionArrayToRegex ( ) ;
27+ }
28+
29+ getConfig ( ) {
30+ return '--config ' + this . config + '.json' ;
31+ }
32+
2533 convertExtensionArrayToRegex ( ) {
2634 // replace array as curly braced string for replacing commas and spaces
2735 let processedExtension = `"{${ this . extensions } }"` . replace ( / \" / g, '' ) . replace ( / \ / g, '' ) ;
@@ -46,9 +54,7 @@ class HTMLValidatePlugin {
4654 // initiate script when webpack compilation is completed
4755 compiler . hooks . done . tap ( 'HTMLValidatePlugin' , ( ) => {
4856 // set up cli payload
49- const userParams = `${ this . path } .${ this . convertExtensionArrayToRegex ( ) } ${
50- this . config ? '--config ' + this . config + '.json' : this . config
51- } `;
57+ const userParams = `${ this . path } .${ this . getExtensions ( ) } ${ this . getConfig ( ) } ` ;
5258 const spawnParams = {
5359 shell : true ,
5460 /*inherit color output */ stdio : 'inherit' ,
You can’t perform that action at this time.
0 commit comments