This repository was archived by the owner on Dec 10, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,12 +102,14 @@ function pluginInit(patternlab) {
102102 //we are also being a bit lazy here, since we only expect one file
103103 let tabJSFileContents = fs . readFileSync ( pluginFiles [ i ] , 'utf8' ) ;
104104 var snippetString = '' ;
105- for ( let j = 0 ; j < pluginConfig . tabsToAdd . length ; j ++ ) {
106- let tabSnippetLocal = tab_frontend_snippet . replace ( / < < t y p e > > / g, pluginConfig . tabsToAdd [ j ] ) . replace ( / < < t y p e U C > > / g, pluginConfig . tabsToAdd [ j ] . toUpperCase ( ) ) ;
107- snippetString += tabSnippetLocal + EOL ;
105+ if ( pluginConfig . tabsToAdd && pluginConfig . tabsToAdd . length > 0 ) {
106+ for ( let j = 0 ; j < pluginConfig . tabsToAdd . length ; j ++ ) {
107+ let tabSnippetLocal = tab_frontend_snippet . replace ( / < < t y p e > > / g, pluginConfig . tabsToAdd [ j ] ) . replace ( / < < t y p e U C > > / g, pluginConfig . tabsToAdd [ j ] . toUpperCase ( ) ) ;
108+ snippetString += tabSnippetLocal + EOL ;
109+ }
110+ tabJSFileContents = tabJSFileContents . replace ( '/*SNIPPETS*/' , snippetString ) ;
111+ fs . outputFileSync ( writePath , tabJSFileContents ) ;
108112 }
109- tabJSFileContents = tabJSFileContents . replace ( '/*SNIPPETS*/' , snippetString ) ;
110- fs . outputFileSync ( writePath , tabJSFileContents ) ;
111113 }
112114 } catch ( ex ) {
113115 console . trace ( 'plugin-node-tab: Error occurred while copying pluginFile' , pluginFiles [ i ] ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " plugin-node-tab" ,
3- "version" : " 2.0.0 " ,
3+ "version" : " 2.0.1 " ,
44 "description" : " " ,
55 "main" : " index.js" ,
66 "dependencies" : {
You can’t perform that action at this time.
0 commit comments