Custom tag registration doesn't work in Liquid v10
See original GitHub issueHi. In Liquidjs v9 I have the following code to create custom tags:
engine.registerTag('upper', {
parse: function(tagToken, remainTokens) {
this.str = tagToken.args;
},
render: async function(ctx) {
const str = await this.liquid.evalValue(this.str, ctx);
return str.toUpperCase();
}
});
This code fails in Liquid 10: Uncaught RenderError: Cannot read properties of undefined (reading 'toUpperCase')
.
I found this example in the documentation but it doesn’t work either:
engine.registerTag('upper', {
parse: function(tagToken) {
this.str = tagToken.args; // name
},
render: function*(ctx) {
const str = yield this.liquid.evalValue(this.str, ctx);
return str.toUpperCase()
}
});
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to rewrite a registerTag from v9 to be v10 compatible?
However it complains that value does not exist on Tag , that token cannot be found as well as that liquid cannot be...
Read more >Rails 3 with Liquid Custom Tags not found
Then created an initializer (in config/initializers) responsible for registering the custom tags with Liquid. i.e.. Liquid::Template.register_tag('custom_tag', ...
Read more >How to check the mailing status of my online custom or ...
Allow at least six weeks for the custom plates to arrive. Your new registration documents will be mailed separately from your new custom...
Read more >Welcome to the Vanity Plate Search & Order Online Service
Maine registrants with a current vehicle registration who wish to display a personalized license plate on their vehicle. Who CANNOT use this service?...
Read more >The7 — Website and eCommerce Builder for WordPress
The7 is designed to work in synergy with Elementor and WooCommerce. ... Pre-made Websites (or Demo Sites) not only showcase the theme ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the fast response.
I don’t have any preference, so if it’s more perfomant this suggestion, I’ll change it. Can you provide an example for that (or update the example in the documentation)? Somethig like this:
Perfect. Thanks!