https://github.com/kentcdodds/cra-macro-example
This is an example of how you can use Create React App with Babel Plugin Macros.
https://github.com/kentcdodds/cra-macro-example
babel babel-plugin-macros create-react-app kcd-edu macros react
Last synced: 12 days ago
JSON representation
This is an example of how you can use Create React App with Babel Plugin Macros.
- Host: GitHub
- URL: https://github.com/kentcdodds/cra-macro-example
- Owner: kentcdodds
- Created: 2019-08-02T02:39:06.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2021-01-25T23:13:00.000Z (over 4 years ago)
- Last Synced: 2025-04-23T00:08:58.556Z (12 days ago)
- Topics: babel, babel-plugin-macros, create-react-app, kcd-edu, macros, react
- Language: JavaScript
- Homepage: https://codesandbox.io/s/github/kentcdodds/cra-macro-example
- Size: 134 KB
- Stars: 39
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Create React App + Babel Plugin Macros
This is an example of how you can use
[Create React App](https://facebook.github.io/create-react-app/) with
[Babel Plugin Macros](https://github.com/kentcdodds/babel-plugin-macros).It demonstrates not only using one of the many
[published macros](https://www.npmjs.com/search?q=keywords:babel-plugin-macros)
(specifically [`ms.macro`](https://www.npmjs.com/package/ms.macro)), but also
[how to write](https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md)
and use your own with the `evil.macro.js` example.[It even works in codesandbox](https://codesandbox.io/s/github/kentcdodds/cra-macro-example).
(However, due to caching issues, modifying the macro itself on codesandbox is
not currently working. Feel free to
[file an issue on codesandbox about this](https://github.com/codesandbox/codesandbox-client/issues/new/choose))[Learn how to get started writing your own macros](https://kentcdodds.com/blog/write-your-own-code-transform).