Skip to content

Commit

Permalink
chore: fix compiled file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Feb 3, 2021
1 parent 0119f05 commit 566e87a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -25,12 +25,12 @@ This method compiles a template source into Javascript code.
const fs = require('fs').promises;
const path = require('path');
const benchpress = require('benchpressjs');
const viewsDir = path.join(__dirname, 'views');
const viewsDir = '/path/to/compiled/templates';

(async () => {
const template = 'My favourite forum software is {forum}. This templating engine is written in {language}.';
const precompiled = await benchpress.precompile(template.toString(), { filename: `${tpl}.tpl` });
await fsPromises.writeFile(path.join(viewsDir, `${tpl}.js`), precompiled);
await fsPromises.writeFile(path.join(viewsDir, `${tpl}.jst`), precompiled);
})();
```

Expand Down

0 comments on commit 566e87a

Please sign in to comment.