Khan / aphrodite

Framework-agnostic CSS-in-JS with support for server-side rendering, browser prefixing, and minimum CSS generation
5.34k stars 188 forks source link

Add a public API to return the definition for a style #307

Open kevinbarabash opened 6 years ago

kevinbarabash commented 6 years ago

I was experimenting with Storybook's jsx addon. Here's its output for a component that's passed an aphrodite style as a prop:

screen shot 2018-03-08 at 2 45 54 pm

I would like to update the plugin to handle aphrodite styles more gracefully by being display the definition for the rule instead of the aphrodite internals.

Proposed API:

function getStyleDefinition(style) => Object
lencioni commented 6 years ago

To clarify, you would expect this to return the value of the _definition key?

kevinbarabash commented 6 years ago

Yes. But we might change how we store the definition in the future. This might make sense as a separate package inside this repo.

lencioni commented 6 years ago

I think I feel similar to https://github.com/Khan/aphrodite/issues/306#issuecomment-373825834 about this