babel-plugin-glamorous-displayname
add a displayName property to glamorous components
The problem
You want to use glamorous, but you want to have a better experience with the
DevTools (because you lose the automatic displayName
magic that the react
babel preset gives you).
This solution
Adds the displayName
to glamorous components.
In
const MyStyledButton = glamorous
Out
const MyStyledButton = glamorousbutton
Table of Contents
Installation
This module is distributed via npm which is bundled with node and
should be installed as one of your project's devDependencies
:
npm install --save-dev babel-plugin-glamorous-displayname
Usage
.babelrc
(Recommended)
Via .babelrc
Via CLI
$ babel --plugins glamorous-displayname script.js
Via Node API
babel-plugin-macros
Use with Once you've configured babel-plugin-macros
you can import/require the glamorous
macro at babel-plugin-glamorous/macro
.
For example:
const MyStyledInput = glamorousinput /* your styles */
You could also use
glamorous.macro
if you'd prefer to type less 😀
Inspiration
Other Solutions
I'm not aware of any, if you are please make a pull request and add it here!
Contributors
Thanks goes to these people (emoji key):
Bernard Lin 💻 📖 ⚠️ |
Kent C. Dodds 🐛 💻 📖 🤔 🚇 📢 ⚠️ |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
LICENSE
MIT