Skip to content

Conversation

@irth
Copy link

@irth irth commented Nov 30, 2017

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
Copy link
Author

irth commented Nov 30, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant