Open jowan opened 8 months ago
a better way that is - other than duplicating the preset and making my own with this one change.
We managed in the following way, in your preview.js
add:
import { TwingRenderer } from "@wingsuit-designsystem/pattern";
import { TwingFilter } from "twing";
const renderer = new TwingRenderer();
const environment = renderer.getEnvironment();
const foo = (value) => `${value} foo`;
environment.addFilter(
new TwingFilter("foo", (value) => Promise.resolve(foo(value)))
);
configure(
...
renderer
);
I have some custom Twing filters that correspond to Twig filters in a custom Drupal module. I am including these using a patch to load them in to
environment.js
duplicating the existing method. Is there a better way to do this ? it's not so bad, but it is a hack.File
@wingsuit-designsystem/preset-twing/dist/environment.js
Including my filters:
loading them to the environment: