npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

storybook-typo3fluid

v0.2.1

Published

Render TYPO3 Fluid templates.

Downloads

73

Readme

Storybook Addon TYPO3 Fluid

Render TYPO3 Fluid templates in Storybook.

Requirements

  • installed and configured TYPO3 instance with typo3fluid-api extension installed

Installation

Install with npm

npm i storybook-typo3fluid

Create a .env file in your Storybook folder and add the following environment variables which should match with the typo3fluid-api extension settings in your TYPO3 instance.

STORYBOOK_TYPO3FLUID_API_URL="<absolute path to typo3 typo3fluid-api endpoint>"
STORYBOOK_TYPO3FLUID_API_PASSWORD=""

Usage

Stories for TYPO3 Fluid templates are similar to html stories. The only difference is how you create the component template inside the story. Use the FluidTemplate function to indicate which TYPO3 Fluid template you want to render. The passed arguments args contain all defined arguments from your story which will be made available in the TYPO3 Fluid template you want to use.

import { FluidTemplate } from "storybook-typo3fluid";

const Template = (args) => FluidTemplate({
  extension: '<extension name>',
  template: '<template name>',
  partial: '<partial name>',
  section: '<(optional) section name>',
  args
});

Compare this to an official html template from storybook.

import { createButton } from './Button';

const Template = ({ label, ...args }) => {
  return createButton({ label, ...args });
};

Builder differences

Storybook uses the webpack builder by default which storybook-typo3fluid also supports by default. With some changes to your code you can also use @storybook/builder-vite with this package.

  • Add the STORYBOOK_ Prefix as an additional envPrefix in your vite.config.js.

    export default {
      envPrefix: [
        'VITE_',
        'STORYBOOK_'
      ]
    }
  • Import the Vite entrypoint file in your stories as such:

    import { FluidTemplate } from "storybook-typo3fluid/dist/vite";

Limitations

  • In stories defined callback functions are not yet supported.

Static Storybook build

If you want to use a static build of Storybook with access to a different TYPO3 instance you need to add the environment variables to the build process as such:

STORYBOOK_TYPO3FLUID_API_URL="" STORYBOOK_TYPO3FLUID_API_PASSWORD="" npm run build-storybook