Code Review: Extend­ing Twig with a new Tag and the MN Twig Per­ver­sion Plugin

Do you write clean, optimized code and aspire to best practices? Whether you're actively developing Craft plugins or just getting started, in this Code Review we'll demo real Craft plugin code that's out in the wild and discuss what we can learn from it and how to make it better.

This week we'll look at MN Twig Perversion, one of the daring plugins that has ventured into extending Twig to create a new Twig Tag. Twig Tags are a complex feature that require we get a better understanding of Twig's internals as we extend the template engine with Token Parser and Node classes.

Level up in Craft CMS with practical examples, snippets, and patterns.
Craft The Planet emails are sent out several times a week.