@@ -62,27 +62,31 @@ class TemplatesGenProcess {
6262 const templateEjsPathExist = this . fileSystem . pathIsExist ( templateEjsPath ) ;
6363 const templateEtaPathExist = this . fileSystem . pathIsExist ( templateEtaPath ) ;
6464
65- if ( this . config . rewrite || ( ! templateEjsPathExist && ! templateEtaPathExist ) ) {
65+ const templateNotExist = ! templateEjsPathExist && ! templateEtaPathExist ;
66+
67+ if ( templateNotExist ) {
6668 this . fileSystem . createFile ( {
6769 path : outputPath ,
6870 fileName : template . name ,
6971 content : template . content ,
7072 withPrefix : false ,
7173 } ) ;
72- } else if ( templateEjsPathExist ) {
73- this . fileSystem . createFile ( {
74- path : outputPath ,
75- fileName : `${ templateName } .ejs` ,
76- content : template . content ,
77- withPrefix : false ,
78- } ) ;
79- } else if ( templateEtaPathExist ) {
80- this . fileSystem . createFile ( {
81- path : outputPath ,
82- fileName : `${ templateName } .eta` ,
83- content : template . content ,
84- withPrefix : false ,
85- } ) ;
74+ } else if ( this . config . rewrite ) {
75+ if ( templateEjsPathExist ) {
76+ this . fileSystem . createFile ( {
77+ path : outputPath ,
78+ fileName : `${ templateName } .ejs` ,
79+ content : template . content ,
80+ withPrefix : false ,
81+ } ) ;
82+ } else if ( templateEtaPathExist ) {
83+ this . fileSystem . createFile ( {
84+ path : outputPath ,
85+ fileName : `${ templateName } .eta` ,
86+ content : template . content ,
87+ withPrefix : false ,
88+ } ) ;
89+ }
8690 }
8791 } ) ;
8892
0 commit comments