@@ -10,10 +10,10 @@ const ejs = require('ejs')
10
10
// https://github.com/sass/node-sass
11
11
const sass = require ( 'node-sass' )
12
12
13
- module . exports = ( template = 'index' , data = { } , lang = 'en_us' , themeColor = '#6c757d' ) => {
13
+ module . exports = ( template , data = { } , lang = 'en_us' , themeColor = '#6c757d' ) => {
14
14
return new Promise ( ( resolve , reject ) => {
15
15
// setup dictionary object first
16
- const i18n = path . join ( __dirname , `i18n/${ lang } .json` )
16
+ const i18n = path . join ( process . cwd ( ) , `i18n/${ lang } .json` )
17
17
fs . readFile ( i18n , 'utf8' , ( err , contents ) => {
18
18
if ( err ) {
19
19
return reject ( err )
@@ -27,7 +27,7 @@ module.exports = (template = 'index', data = {}, lang = 'en_us', themeColor = '#
27
27
}
28
28
29
29
// render Sass to CSS with theme color
30
- const scss = path . join ( __dirname , `scss/${ template } .scss` )
30
+ const scss = path . join ( process . cwd ( ) , `scss/${ template } .scss` )
31
31
fs . readFile ( scss , 'utf8' , ( err , contents ) => {
32
32
if ( err ) {
33
33
return reject ( err )
@@ -47,7 +47,7 @@ module.exports = (template = 'index', data = {}, lang = 'en_us', themeColor = '#
47
47
data . themeColor = themeColor
48
48
49
49
// render EJS file to HTML
50
- const view = path . join ( __dirname , `views/${ template } .ejs` )
50
+ const view = path . join ( process . cwd ( ) , `views/${ template } .ejs` )
51
51
ejs . renderFile ( view , data , null , ( err , html ) => {
52
52
if ( err ) {
53
53
reject ( err )
0 commit comments