babel-plugin-object-styles-to-template
babel-plugin-object-styles-to-template copied to clipboard
Add a babel-macros macro
This patch allows using the plugin as follows, with babel-macros installed:
import css from 'babel-plugin-object-styles-to-template/macro';
const container = css({
flex: 1,
padding: 10,
backgroundColor: 'orange',
color: colors.white,
'&:hover': {
backgroundColor: 'tomato'
}
});
With babel-macros, there is no need to modify the .babelrc to use this plugin, assuming babel-macros is already configured.
After merging, it'd probably be good to create a dedicated npm package exporting the macro, e.g. object-styles-to-template.macro
)
(This is my first ever experience with babel plugins and macros but the code is minimal so I guess there's not much space for anything to go wrong)