Skip to content

Commit

Permalink
Clean up README
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Apr 20, 2018
1 parent a7a0d42 commit 9cfe8d5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Try EJS online at: https://ionicabizau.github.io/ejs-playground/.
## Usage

```javascript
var template = ejs.compile(str, options);
let template = ejs.compile(str, options);
template(data);
// => Rendered HTML string

Expand Down Expand Up @@ -134,7 +134,7 @@ still supported.
Custom delimiters can be applied on a per-template basis, or globally:

```javascript
var ejs = require('ejs'),
let ejs = require('ejs'),
users = ['geddy', 'neil', 'alex'];

// Just one template
Expand All @@ -154,7 +154,7 @@ functions used to render templates. It's easy to plug in LRU caching using
Node's `lru-cache` library:

```javascript
var ejs = require('ejs'),
let ejs = require('ejs'),
LRU = require('lru-cache');
ejs.cache = LRU(100); // LRU cache with 100-item limit
```
Expand All @@ -163,13 +163,13 @@ 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 FileLoader
## Custom file loader

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

```javascript
var ejs = require('ejs');
var myFileLoad = function (filePath) {
let ejs = require('ejs');
let myFileLoad = function (filePath) {
return 'myFileLoad: ' + fs.readFileSync(filePath);
};

Expand Down Expand Up @@ -210,7 +210,7 @@ Include one of these files on your page, and `ejs` should be available globally.
<div id="output"></div>
<script src="ejs.min.js"></script>
<script>
var people = ['geddy', 'neil', 'alex'],
let people = ['geddy', 'neil', 'alex'],
html = ejs.render('<%= people.join(", "); %>', {people: people});
// With jQuery:
$('#output').html(html);
Expand All @@ -224,22 +224,22 @@ Include one of these files on your page, and `ejs` should be available globally.
Most of EJS will work as expected; however, there are a few things to note:

1. Obviously, since you do not have access to the filesystem, `ejs.renderFile()` won't work.
2. For the same reason, `include`s do not work unless you use an `IncludeCallback`. Here is an example:
2. For the same reason, `include`s do not work unless you use an `include callback`. Here is an example:
```javascript
var str = "Hello <%= include('file', {person: 'John'}); %>",
let str = "Hello <%= include('file', {person: 'John'}); %>",
fn = ejs.compile(str, {client: true});

fn(data, null, function(path, d){ // IncludeCallback
fn(data, null, function(path, d){ // include callback
// path -> 'file'
// d -> {person: 'John'}
// Put your code here
// Return the contents of file as a string
}); // returns rendered string
```
### IDE Integrations with Syntax Highlighting
+ VSCode:Javascript EJS by *DigitalBrainstem*

### IDE Integration with Syntax Highlighting

VSCode:Javascript EJS by *DigitalBrainstem*

## Related projects

Expand Down

0 comments on commit 9cfe8d5

Please sign in to comment.