Currently, each babel plugin in the babel ecosystem requires that you configure it individually. This is fine for things like language features but can be a frustrating overhead for libraries that allow for compile-time code transformation as an optimization. babel-plugin-macros defines a standard interface for libraries that want to use compile-time code transformation without requiring the user to add a babel plugin to their build system (other than babel-plugin-macros, which is ideally already in place). There is cpu usage/time overhead; the client needs to run the code to generate these classes every time the page loads. There is code bundle size overhead; the client needs to receive a CSS parser in order to generate these class names, and shipping this makes the amount of js the client needs to parse larger. Eval-ing out code at compile time that will be baked into the runtime code, for instance, to get a list of directories in the filesystem.

Features

  • Many css-in-js libraries have a css tagged template string function
  • There is cpu usage/time overhead
  • There is code bundle size overhead
  • Most of the time you'll probably be using this with the babel cache enabled in webpack to rebuild faster
  • You can write your own without publishing them to npm
  • Requires only one entry in .babelrc for all macros used in project

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow babel-plugin-macros

babel-plugin-macros Web Site

Other Useful Business Software
$300 Free Credits for Your Google Cloud Projects Icon
$300 Free Credits for Your Google Cloud Projects

Start building on Google Cloud with $300 in free credits. No commitment, no credit card required until you're ready to scale.

Launch your next project with $300 in free Google Cloud credits—no strings attached. Test, build, and deploy without risk. Use your credits across the entire Google Cloud platform to find what works best for your needs. After your credits are used, continue with always-free tier services. Only pay when you're ready to scale. Sign up in minutes and start exploring.
Start Free Trial
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of babel-plugin-macros!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Build Tools, JavaScript Libraries

Registered

2022-04-07