Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: add runtimeOptions #53

Merged
merged 2 commits into from
Jul 6, 2020
Merged

Conversation

UziTech
Copy link
Member

@UziTech UziTech commented Jul 3, 2020

Allow runtimeOptions with runtimeOptions option in render options and config options.

This allows you to change this:

const express = require('express')
const expressHandlebars = require('express-handlebars')
const Handlebars = require('handlebars')
const {allowInsecurePrototypeAccess} = require('@handlebars/allow-prototype-access')

const hbs = exphbs.create({
  defaultLayout: 'main', 
  extname: 'hbs',
  handlebars: allowInsecurePrototypeAccess(Handlebars)
});
...

to this:

const express = require('express')
const expressHandlebars = require('express-handlebars')

const hbs = exphbs.create({
  defaultLayout: 'main', 
  extname: 'hbs',
  runtimeOptions: {
    allowProtoPropertiesByDefault: true,
    allowProtoMethodsByDefault: true
  }
});
...

fixes #16
fixes handlebars-lang/handlebars.js#1648 (comment)
fixes handlebars-lang/handlebars.js#1642 (comment)

@UziTech UziTech merged commit f8815e1 into express-handlebars:master Jul 6, 2020
@UziTech UziTech deleted the runtimeoptions branch July 6, 2020 15:49
@github-actions
Copy link

github-actions bot commented Jul 6, 2020

🎉 This PR is included in version 4.0.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

# for free to join this conversation on GitHub. Already have an account? # to comment