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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ilo-org/twig

v1.11.1

Published

Twig components for the ILO's Design System

Readme

ILO Design System - Twig Package

This package provides the implementation of the Design System using Twig. It also includes a Storybook project for documentation and development of the components in the system. Storybook and twig integration is done by the internal Maestro. It has dependencies on the following other @ilo-org packages:

Drupal Integration

Available Commands

Prerequisites

  • Node.js version 20 or higher
    • You can use nvm to manage your Node.js versions
  • pnpm installed globally or via corepack >= 9.14.0

Getting Started

Before running any of the commands below, make sure to:

  1. Run pnpm install from the monorepo root to install all dependencies
  2. Run pnpm build:libs from the monorepo root to build all necessary packages

| Command | Description | | ------------------ | ------------------------------------------------------------ | | pnpm build:lib | Builds the library | | pnpm build:docs | Generates static Storybook documentation | | pnpm storybook | Starts Storybook development server on port 6006 | | pnpm start:theme | Starts Docker containers in detached mode(Used in tests) | | pnpm cr:theme | Rebuilds Drupal cache inside Docker container(Used in tests) | | pnpm cy:open | Opens Cypress test runner(Used in tests) | | pnpm test | Runs Cypress tests in headless mode(Used in tests) | | pnpm lint | Runs ESLint to check code quality | | pnpm lint:fix | Runs ESLint with automatic fixes |

Development

Each component is located in the src/components folder. Each component has its own folder named after the component. Inside each component folder, you will find:

  • [component].twig: The Twig template file for the component. (Required)
  • [component].component.yml: UI Patterns definition for the component. This file will be used for the story generation too. (Required)
  • [component].js: The JavaScript file for the component. (Optional)
  • [component].behavior.js: The Drupal behavior runner for attaching the JS bundle to the component. (Optional)
  • Sub components can be also created inside the component folder (Check the accordion component for reference)

The storybook is a source of truth for the components. Each component will have its own stories file located in the stories/[component].stories.js file. The stories are generated from the UI Patterns definition file using the Maestro.

Here is an example of a story file for the button component:

import Button from "../src/components/button/button.twig"; // Twig template
import ButtonPatterns from "../src/components/button/button.component.yml"; // UI Patterns definition
import { Maestro } from "@ilo-org/maestro";

const story = Maestro.create(Button, ButtonPatterns); // Generates a meta and stories from the UI Patterns definition

const Meta = {
  title: "Components/User Interface/Button",
  tags: ["autodocs"],
  ...story.meta,
};

const [Default] = story.stories; // Extracts the generated story

export default Meta;

export { Default };

For more details about the Maestro check the Maestro documentation.

Testing

We are using Cypress for component testing. To achieve this, we have a Drupal instance running inside a Docker container. The Drupal instance has the ILO Base Theme installed and configured. The components are rendered using the Base Theme and then tested using Cypress.

You can start the Docker containers using the following command:

pnpm run start:theme

After that you can check the localhost:8082 to see the Drupal instance running.

To open the Cypress test runner, you can use the following command:

pnpm run cy:open

You can find the tests in the cypress/e2e folder. Each component will have its own test file named after the component.

Contributing

For contribution guidelines, please refer to the Main Documentation.