Skip to content

Is there any plan to seperate options from locals? #309

@wxfred

Description

@wxfred

In lib/consolidate.js, there are many render functions use locals as options to build a template, then again, transfer the locals to the template for constructing the final page. So, users may ignore the potential issue that their locals could be used as options for the engine. And, this shortcut is not recommend by ejs.

However, be aware that your code could break if we add an option with the same name as one of your data object's properties. Therefore, we do not recommend using this shortcut. -- from https://www.npmjs.com/package/ejs

I think changing the interface from
(path[, locals], callback)
to
(path[, locals, options], callback)
will be a good solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions