leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
649 stars 159 forks source link

Mention generic options config in readme #179

Open mslourens opened 3 years ago

mslourens commented 3 years ago

I was looking for a way to set runtime options for handlebars, and came across the changelog for version 0.6.5, where this was mentioned, but in the readme it was not mentioned at all. It would be a good idea to mention it somewhere, so this option can be used. This is the way to set runtime options like allowProtoPropertiesByDefault, right?

Cortlandd commented 2 years ago

@mslourens Bump. Did doing so work for you?

Cortlandd commented 2 years ago

I'm thinking is the following what we need?

require 'handlebars_assets'

HandlebarsAssets::Config.options = {
  allowProtoMethodsByDefault: true,
  allowedProtoMethods: true    
}
mslourens commented 2 years ago

yes, that's what I meant.

Cortlandd commented 2 years ago

I added that to config/initializers/handlebars.js but no luck. Went with

HandlebarsTemplates['TEMPLATE']({file: { name: file.name }})

but previously had

HandlebarsTemplates['TEMPLATE']({file: file})