@bloomreach/banana-theme
v1.0.0
Published
Bloomreach Banana Theme
Maintainers
Keywords
Readme
Bloomreach Banana Theme
About
@bloomreach/banana-theme ships the Banana design tokens as
CSS custom properties, plus the Banana fonts and icons. The design guidelines
live on banana.supernova-docs.io.
Browse every token and icon in the Storybook (see Storybook below).
Upgrading from 0.x? 1.0.0 removes the legacy tokens and renames some icons. See MIGRATION.md.
Getting Started
Installation
npm install @bloomreach/banana-themeExports
| Export | Contents |
| ---------------------- | ----------------------------------------------------------------------- |
| css/theme-tokens.css | All tokens as CSS custom properties on :root |
| css/fonts.css | @font-face rules for Inter and Roboto Mono (weights 100–700) |
| icons/* | SVG icons: icons/<name>.svg (16px) and icons/24px/<name>.svg (24px) |
Tokens
Import the tokens once, at the root of your styles. They work with any tooling, including Sass, and can be changed at runtime.
@import '@bloomreach/banana-theme/css/theme-tokens.css';
.button {
background-color: var(--banana-color-button-primary-background-default);
padding: var(--banana-space-1x) var(--banana-space-2x);
}Component colors are named --banana-color-[component]-[variant]-[property]-[state], for example
--banana-color-button-secondary-border-hover. Palette colors are --banana-color-[hue]-[shade], for example
--banana-color-gold-500. Each --banana-typography-* token is a complete font shorthand:
h1 {
font: var(--banana-typography-heading-h1);
}Fonts
The font rules are not part of theme-tokens.css. Import them separately:
@import '@bloomreach/banana-theme/css/fonts.css';Or from JavaScript, when your bundler handles CSS imports:
import '@bloomreach/banana-theme/css/fonts.css';Without a bundler, you can load them from a CDN like unpkg.com:
<link rel="stylesheet" href="https://unpkg.com/@bloomreach/banana-theme@1/dist/css/fonts.css" />Icons
Icons are plain SVG files:
import cartIcon from '@bloomreach/banana-theme/icons/24px/cart.svg';Development
Prerequisites for working on this repository (consumers only need the published files):
- Node.js (v24 or higher)
- pnpm (version pinned in
package.json#packageManager; runcorepack enableto use it)
The tokens come from tokens/supernova/index.css, exported from Supernova; replace that file to update them. The fonts
are listed in tokens/font/assets.json and the icons are in assets/icons. scripts/build.ts builds everything into
dist.
Build
Build the theme and output it to the dist directory. It will generate the following files:
dist/css/theme-tokens.css(tokens, fromtokens/supernova/index.css)dist/css/fonts.css(font rules, fromtokens/font/assets.json)dist/assets/fonts/*.woff,dist/assets/fonts/*.woff2(font files)dist/assets/icons/**(icons)
Ensure the dependencies are installed with pnpm install before running the build command.
pnpm buildLint
Code is linted with oxlint (.oxlintrc.json) and formatted with
oxfmt (.oxfmtrc.json). tokens/ and dist/ are never formatted, since
they are the published output.
Run the following command to lint the files and check their formatting:
pnpm lintThe scripts run as native TypeScript in Node 24, which strips types without checking them, so a separate command is available to check the types using the TypeScript compiler.
pnpm lint:typesTo format the files, or to also apply the automatic lint fixes, run one of the following commands:
pnpm format
pnpm lint:fixTest
Run the following command to run the tests:
pnpm testClean
Delete the dist directory.
Note: the build command already deletes the dist directory before building.
pnpm cleanRelease
The release process is split into three steps: generating the changelog, bumping the version and publishing the package. Generating the changelog and bumping the version is handled by the developer, the package is then published by the CI/CD pipeline.
Changelog
To generate the changelog, run the following command:
pnpm changelog <version> <fileName>The version argument is the version that you are releasing, e.g. 0.0.1. The fileName argument is the name of the file
that the changelog will be written to, e.g. CHANGELOG.md. If the file already exists, the changelog will be appended to
the file. If the fileName argument is omitted, the changelog will be written to the console.
Note: the changelog will not include any Jira data other than the ticket number. For the best results, you should add the ticket title(s) manually.
Version
To bump the version, we use the npm version command (pnpm version does something different). This will update
the version in the package.json file, commit it, and create a git tag.
Use the following command to bump the version:
npm version patch -m "BAN-1 Release v%s"Note: the patch argument can be replaced with minor or major depending on the type of release.
Note2: the -m argument is required to alter the commit message and specify a valid Jira ticket number.
Note3: The %s will be replaced with the version number.
Publish
After bumping the version, push the changes to the remote repository. This will trigger the CI/CD pipeline to publish the package to the npm registry.
Storybook
The Storybook previews everything the package ships: the tokens by category, the fonts and the icons. It is
published for every branch to https://design.corp.bloomreach.com/storybooks/banana/<branch>/.
Start it locally with:
pnpm storybookThis builds the package, watches for changes and opens Storybook at localhost:6006.
