This repository was archived by the owner on May 11, 2026. It is now read-only.
v3.8.0-rc.2
Pre-release
Pre-release
This pre-release adds experimental support for isolating styles for a component variant. Given a .happo.js config like this:
// .happo.js
module.exports = {
stylesheets: [
'/path/to/global-styles.css', // regular string paths are still supported
{ source: '/path/to/foo-styles.css' id: 'foo', conditional: true }, // new object structure
{ source: '/path/to/bar-styles.css' id: 'bar', conditional: true },
],
};When you specify components and its variants, you can now add a local stylesheets option to isolate styles for a variant. E.g.
// Foo-happo.js
export default [
{
component: 'Button',
variants: {
withFooStyles: {
render: () => <Button />,
stylesheets: ['foo'],
},
withBarStyles: {
render: () => <Button />,
stylesheets: ['bar'],
},
withOtherStyles: () => <Button />,
},
},
];
Here, the withFooStyles will have styling from /path/to/foo-styles.css applied, plus /path/to/global-styles.css (since it isn't conditional). The withBarStyles variant will have /path/to/bar-styles.css + /path/to/global-styles.css applied. And withOtherStyles will only have /path/to/global-styles.css applied.