How to use the fileLoader function from ejs

Find comprehensive JavaScript ejs.fileLoader code examples handpicked from public code repositorys.

98
99
100
101
102
103
104
105
106
107
```

*If you want to clear the EJS cache, call ejs.clearCache. If you're using the LRU cache and need a different limit, simple reset ejs.cache to a new instance of the LRU.*

### Custom file loader
The default file loader is fs.readFileSync, if you want to customize it, you can set ejs.fileLoader.

```javascript
let ejs = require('ejs');
let myFileLoad = function (filePath) {
fork icon33
star icon76
watch icon1

26
27
28
29
30
31
32
33
34
35
  bundleReport: BundlesReportI,
  options: OptionsI
) {
  const path = join(__dirname, 'views', 'result.ejs');
  const targetPath = join(process.cwd(), '/bba', 'bba');
  const ejsString = ejs.fileLoader(path, 'utf8'),
    template = ejs.compile(ejsString, {
      bundleReport,
      options,
      filename: path,
fork icon0
star icon5
watch icon2

197
198
199
200
201
202
203
204
205
206
LRU cache and need a different limit, simple reset `ejs.cache` to a new instance
of the LRU.

### Custom file loader

The default file loader is `fs.readFileSync`, if you want to customize it, you can set ejs.fileLoader.

```javascript
let ejs = require('ejs');
let myFileLoad = function (filePath) {
fork icon781
star icon0
watch icon121