babel-plugin-object-styles-to-template icon indicating copy to clipboard operation
babel-plugin-object-styles-to-template copied to clipboard

Add a babel-macros macro

Open irth opened this issue 7 years ago • 1 comments

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)

irth avatar Nov 30 '17 20:11 irth

(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)

irth avatar Nov 30 '17 20:11 irth