Needs Twig template adapter
See original GitHub issueCurrently twig.js can be used via the consolidate adapter, but it’s not great (no @handle
includes etc).
A decent Twig adapter would really open up easier PHP implementations (plus Twig rocks 😉).
An adapter using the native PHP twig engine under the hood has been started here: https://github.com/LostKobrakai/twig but would also be nice to have one built around Twig.js (or one that let’s you choose which one to use?) so that PHP is not a required dependency.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12
Top Results From Across the Web
@frctl/twig - npm
An adapter to let you use Twig templates with Fractal. Requires Fractal v1.1.0 or greater. To install this adapter run this command:.
Read more >markdown_to_html - Documentation - Twig - The flexible, fast ...
Twig - The flexible, fast, and secure template engine for PHP. ... composer require twig/markdown-extra. Then, on Symfony projects, install the ...
Read more >Template engines - Fractal
If you don't need to customise the template engine adapter, you can just pass its package name into the .engine() method directly:.
Read more >@wondrousllc/fractal-twig-drupal-adapter - npm package | Snyk
Twig template adapter for Fractal with Drupal 8 directives. For more information about how to use this package see ... Security review needed....
Read more >Using Twig - mezzio - Laminas Docs
Twig is a template language and engine provided as a standalone component by SensioLabs. It provides: ... composer require mezzio/mezzio-twigrenderer ...
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
If anyone else comes across this, the fractal project has a twig adaptor: https://github.com/frctl/twig
I am currently using the 1.0.0-beta.1 successfully.
I was frustrated to discover that the Twig
{{ path }}
helper was working fine for me in the Web UI (over the localhost:3000 server), but inexplicably was set tonull
when building the static version, breaking my static asset paths. After digging through the Twig adapter source files, I realized thatpath
is a filter. Not sure why this works differently for me compared to what’s in the documentation, and why it’s different than the suggested concatenation{{ path ~ '/css/main.css' }}
fix mentioned above, butpath
now works consistently for me if I use it as a Twig filter like so:{{ '/styles.css' | path }}
Full example of my preview markup:
Hope that helps someone, or if anyone knows a better way to fix I’d be glad to know! FWIW, my Fractal build step is handled through Gulp (not sure if that matters).