A collection of awesome babel macros and related resources
preval.macro
: Pre-evaluate code1codegen.macro
: Generate code1import-all.macro
: Import all files that match a globtagged-translations
: Translate text in React applicationstraph.macro
: Transform Objects easily, leveraging object getters and graphsparam.macro
: Partial application syntax and lambda parameters for JavaScript, inspired by Scala's_
and Kotlin'sit
ms.macro
: Convert various time formats to millisecondsreact-emotion/macro
: Minify and optimize emotion stylesscope.macro
: Useful build time console functionsgraphql.macro
: Compile GraphQL ASTsvgr.macro
: Run SVGRglamorous.macro
: Give your glamorous components a nicedisplayName
for React DevToolsraw.macro
: Webpack raw-loaderpenv.macro
: Pick specified value or branch according to the build environmentlqip.macro
: Cretes LQIP at build time, similar to webpack lqip-loaderdev-console.macro
: Remove all console.log, console.warn and console.error calls from production buildsdata-uri.macro
: Convert assets to data URIscss-to-rn.macro
: Convert CSS to React Native style sheetregexgen.macro
: Convert set of strings to optimized RegExpstinker.macro
: Evaluate Laravel code@lingui/macro
: Macros for internationalization (i18n) in LinguiJSunique-classname.macro
: Generate unique className for emotionidx.macro
: Traverse properties on objects and arrayspipeline.macro
: Macro working similarly to the pipeline operatorblade.macro
: Generate GraphQL query strings inline and solve the double declaration problemstyled-jsx/macro
: Use styled-jsx'sresolve
tagstyled-components.macro
: Improve the debugging experience and add server-side rendering support to styled-componentsbabel-plugin-trace/macro
: Add labeled statement logging helpers with file- and function name prefix
babel-plugin-macros
usage- Search npm for keyword:babel-plugin-macros to find macros
- Difference between plugins and macros
- Zero-config code transformation with babel-plugin-macros
babel-plugin-macros
usage for macro authors- jamiebuilds/babel-handbook
- Writing custom Babel and ESLint plugins with ASTs
- Code Transformation and Linting
The following projects include babel-plugin-macros
, so macros can be used out-of-the-box without additional configuration:
Contributions welcome! Read the contribution guidelines first.
To the extent possible under law, Jonas Gierer has waived all copyright and related or neighboring rights to this work.