nl_tokens: Generate template for a single file
pl_tokens: function generateTemplate ( templateFile , snippetsDir ) { const titleTemplateFile = templateFile . replace ( '.template.html' , '.title-template.html' ) ; const outputTemplateFile = templateFile . replace ( '.template.html' , '.html' ) ; const codeFile = templateFile . replace ( '.template.html' , '.ts' ) ; const styleFile = templateFile . replace ( '.template.html' , '.scss' ) ; const titleTemplateFileContent = fs . readFileSync ( path . resolve ( snippetsDir , titleTemplateFile ) , { encoding : 'utf8' } ) ; const templateFileContent = fs . readFileSync ( path . resolve ( snippetsDir , templateFile ) , { encoding : 'utf8' } ) ; const templateTabHtml = tabHtml ( path . basename ( outputTemplateFile ) , templateFileContent , 'html' ) ; let codeFileContent = fs . readFileSync ( path . resolve ( snippetsDir , codeFile ) , { encoding : 'utf8' } ) ; // The only modification to the source file is to remove the @local prefix from slider import codeFileContent = codeFileContent . replace ( / @local\/ng5-slider / g , "ng5-slider" ) ; const codeTabHtml = tabHtml ( path . basename ( codeFile ) , codeFileContent , 'typescript' ) ; let styleTabHtml = '' ; if ( <mask> . existsSync ( path . resolve ( snippetsDir , styleFile ) ) ) { const styleFileContent = fs . readFileSync ( path . resolve ( snippetsDir , styleFile ) , { encoding : 'utf8' } ) ; styleTabHtml = tabHtml ( path . basename ( styleFile ) , styleFileContent , 'scss' ) ; } const outputHtmlFileContent = ` ${ titleTemplateFileContent } ${ templateFileContent } ${ codeTabHtml } ${ templateTabHtml } ${ styleTabHtml } ` ; fs . writeFileSync ( path . resolve ( snippetsDir , outputTemplateFile ) , outputHtmlFileContent , { encoding : 'utf8' } ) ; }