Closed psebborn closed 6 months ago
This looks good to me
There's some test twig files and it would be good to add one for this functionality
I wonder if we should change it from 'activeTheme' to a more generic 'globalContexts' that allows passing other values too?
The final code uses globalContext: {}
instead of special casing active_theme - example here
Nice one, thank you for adding the tests, I hadn't got round to looking at them yet. I wasn't aware of globalContext
- nice learning for me :)
I added global context here too 👍
On Tue, 9 Jan 2024, 6:20 pm Paul Sebborn, @.***> wrote:
Nice one, thank you for adding the tests, I hadn't got round to looking at them yet. I wasn't aware of globalContext - nice learning for me :)
— Reply to this email directly, view it on GitHub https://github.com/larowlan/vite-plugin-twig-drupal/pull/10#issuecomment-1882596776, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEHR5WM2P7PQTZKAKL5ISTYNT4TLAVCNFSM6AAAAABBOESOKKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBSGU4TMNZXGY . You are receiving this because you modified the open/close state.Message ID: @.***>
This fixes #9 , adding support for custom functions. Usage gudelines:
Add a
functions
object to the Twig constructor, and pass the custom functions you need into there. Use as normal within Twig templates!(NB. I also added the ability for passing in the 'active theme' as sometimes I've used that in projects, and it can be helpful)