-
-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renderStatic not applying some plugins #876
Comments
On searching issues, I think this maybe related: #465 If the goal of If this feature is supported, the most immediate use case specific to Thanks and would love to hear if this is a bug vs feature! |
Quick update, I have an (almost complete) workaround for my problem: const renderStatic = (renderer, style, selector, props) => {
const staticStyle = renderer.plugins.reduce((_acc, plugin) => {
return plugin(style, null, null, props);
}, style);
renderer.renderStatic(staticStyle, selector);
};
const renderer = createFelaRenderer({ enhancers, plugins });
const props = { theme }; // add any additional props that plugins depend on.
renderStatic(renderer, style, element, props); EDIT: While the above applies most plugins and resolved my issue with const ulStyleObject = {
// primitive
color: 'red', // works
marginLeft: 40, // works
// theme-value, responsive-value
padding: 'l', // NOW WORKS!
backgroundColor: ['palette.red1', 'yellow'], // responsive still doesn't work
// nested
'> li': {
paddingLeft: 100, // nesting doesn't work
':hover': {
color: 'pink', // nesting/pseudo doesn't work
}
},
} Feel free to close the issue if this is something that |
Hey @chrisrzhou, Thanks for the bug report!
That sounds amazing! Mind sharing what you're up to? Maybe I can help out or answer some questions :) |
Thanks for confirming it's a bug and I'll contact you soon in the next week or so after I've fleshed things out a bit more. tl;dr, it's proof that Fela is the minimal primitive for building UI/design systems with delightful DX (but you know that already :P). |
A quick question/request while piggybacking on this issue:
This would be huge in the debugging DX, and I can also see this being valuable for consumers who want to use Fela purely as a rules-processing engine, grabbing the data of the evaluated styles for custom use. |
@chrisrzhou This took quite some time, but I finally managed to look into it: #894 Would this solve your issues? We need to manually pass these props when using |
Firstly, thank you so much for this wonderful + delightful + beautiful library ❤️. I'm amazed at how much Fela can do with so little, and I am very close to wiring up something exciting that is only made possible with Fela!
Now onto the bug 😛
Type: Bug
Description
renderStatic
does not seem to work with all plugins, specificallyfela-plugin-theme-value
,fela-plugin-responsive-value
. Not sure if this is an intentional behavior since the docs mentions thatIf
renderStatic
can process style objects using plugins, this is going to be really awesome (great DX in defining static styles using the extended syntax allowed by plugins), so hopefully that is either the expected behavior or something that is on the roadmap.Steps to reproduce
Please see the following Codesandbox example for a repro.
In the example, we will use the
ulStyleObject
to test behaviors rendered throughuseFela
(i.e.renderer.renderRule
) andrenderStatic
. The former behaves as expected but the latter doesn't seem to applying plugins.Expected Behavior
renderStatic
to apply plugin behaviors (fela-plugin-theme-value
andfela-plugin-responsive-value
).Actual Behavior
renderStatic
seems to apply some plugin behaviors in defined byfela-preset-web
(e.g.fela-plugin-unit
) but not those defined byfela-plugin-theme-value
andfela-plugin-responsive-value
.The text was updated successfully, but these errors were encountered: