Skip to content

Instantly share code, notes, and snippets.

@evanxg852000
Created December 24, 2018 10:38
Show Gist options
  • Save evanxg852000/f803feae6d0d7fea3dc769b6b4de6bdd to your computer and use it in GitHub Desktop.
Save evanxg852000/f803feae6d0d7fea3dc769b6b4de6bdd to your computer and use it in GitHub Desktop.
class Templater {
...
constructor(dir, cached){
this._dir = path.resolve(dir)
this._cached = cached || false
this._compiledDir = path.join(this._dir, '.tmp')
// create compiled directory if not exist
if(!fs.existsSync(this._dir)){
throw Error('Template directory does not exist')
}
if (!fs.existsSync(this._compiledDir)) {
fs.mkdirSync(this._compiledDir)
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment