Last active
July 30, 2019 14:14
-
-
Save amazingrando/a8c2ae4e3a421f7d3e5201fc343f55de to your computer and use it in GitHub Desktop.
Twig Filters with Storybook.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { addParameters, configure } from "@storybook/html"; | |
import "../css/tufts_base.css"; | |
import Twig from "./filters"; | |
function loadStories() { | |
const req = require.context("../stories", true, /\.stories\.js$/); | |
req.keys().forEach(filename => req(filename)); | |
} | |
configure(loadStories, module); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Twig = require("twig"); | |
export const link = Twig.extendFunction("link", function( | |
text, | |
uri, | |
attributes | |
) { | |
return `<a href="${uri}">${text}</a>`; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment