Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kentcdodds/preval.macro
Pre-evaluate code at build-time with babel-macros
https://github.com/kentcdodds/preval.macro
Last synced: about 1 month ago
JSON representation
Pre-evaluate code at build-time with babel-macros
- Host: GitHub
- URL: https://github.com/kentcdodds/preval.macro
- Owner: kentcdodds
- Created: 2017-07-14T16:13:53.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2021-01-25T23:16:47.000Z (over 3 years ago)
- Last Synced: 2024-01-24T12:22:25.309Z (4 months ago)
- Language: JavaScript
- Homepage: https://npm.im/preval.macro
- Size: 18.6 KB
- Stars: 126
- Watchers: 3
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Lists
- awesome-javascript - Pre-evaluate code at buildtime - Pre-evaluate your front end javascript code at build-time (QA Tools / Runner)
- awesome-babel-macros - `preval.macro` - evaluate code<span id="backlink-1" />[<sup>1</sup>](#footnote-1) (Macros / Code generation)
- awesome-javascript-cn - Pre-evaluate code at buildtime
- awesome-stars - kentcdodds/preval.macro - Pre-evaluate code at build-time with babel-macros (JavaScript)
- awesome-javascript - Pre-evaluate code at buildtime - Pre-evaluate your front end javascript code at build-time (QA Tools / Runner)
- awesome-javascript-builds-project - Pre-evaluate code at buildtime - Pre-evaluate your front end javascript code at build-time (QA Tools / Runner)
- A-collection-of-awesome-browser-side-JavaScript-libraries-resources-and-shiny-things. - Pre-evaluate code at buildtime - Pre-evaluate your front end javascript code at build-time (QA Tools / Runner)
- awesome-javascript - Pre-evaluate code at buildtime
- awesome-javascript - Pre-evaluate code at buildtime - Pre-evaluate code at build-time with babel-macros ` 📝 a year ago ` (QA Tools [🔝](#readme))
README
# preval.macro
This is a [`babel-plugin-macros`][babel-plugin-macros] macro for
[`babel-plugin-preval`][babel-plugin-preval].Please see those projects for more information.
## Installation
This module is distributed via [npm][npm] which is bundled with [node][node] and
should be installed as one of your project's `devDependencies`:```
npm install --save-dev preval.macro
```You'll also need to install and configure
[`babel-plugin-macros`][babel-plugin-macros] if you haven't already.## Usage
Once you've
[configured `babel-plugin-macros`](https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/user.md)
you can import/require `preval.macro`. For example:```js
import preval from 'preval.macro'const one = preval`module.exports = 1 + 2 - 1 - 1`
```**Note**:
[`babel-plugin-preval`][babel-plugin-preval] allows you to have a few more APIs
than you have with this macro, but this macro comes with all the benefits of
using [`babel-plugin-macros`][babel-plugin-macros] (which you can read about in
the `babel-plugin-macros` docs).[npm]: https://www.npmjs.com
[node]: https://nodejs.org[babel-plugin-macros]: https://github.com/kentcdodds/babel-plugin-macros
[babel-plugin-preval]: https://github.com/kentcdodds/babel-plugin-preval