An adapter that extends the Fractal Twig adapter and introduces include operator in
context data.
npm install --save-dev https://github.com/jerzyucandoimage/fractal-twig-context-subrender.gitin your fractal.js
const fractal = require('@frctl/fractal').create();
const twigAdapter = require('fractal-twig-context-subrender');
const twig = twigAdapter();in the fractal configuration file
supportIncludesInTheContextData: truecontext:
include: 'component-name--variant-name as customVariableName' context:
someDestinationObject:
include: 'component-name--variant-name.path.to.the.source.data.object' context:
someDestinationObject:
include: '...component-name--variant-name' context:
someDestinationObject:
include: '...component-name--variant-name.some.path' context:
someDestinationObject:
include: 'component-name--variant-name.some.path as someCustomVariableName, component-name--variant-name.some.path as anotherCustomVariableName' context:
someDestinationObject:
include1: 'component-name--variant-name.some.path as someCustomVariableName'
include2: 'component-name--variant-name.some.path as anotherCustomVariableName' By default existing variables are not being overriden. To force overriding use ! operator at the end
context:
someDestinationObject:
include: 'component-name--variant-name.some.path!' context:
someDestinationObject:
include: '...component-name--variant-name.some.path!' context:
someDestinationObject:
include: 'component-name--variant-name.some.path as customVariableName!'