Skip to content

Commit

Permalink
Clarifying use of Node API (#911)
Browse files Browse the repository at this point in the history
Making it obvious that the first argument to `.transform()`
is a code string and that the return value is minified code.
  • Loading branch information
tlhunter authored and boopathi committed Oct 9, 2018
1 parent a6cfcb5 commit 6b1c350
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/babel-preset-minify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ babel script.js --presets minify
### Via Node API

```javascript
require("@babel/core").transform("code", {
const babel = require("@babel/core");
const fs = require("fs");

const code = fs.readFileSync("./input.js").toString();

const minified = babel.transform(code, {
presets: ["minify"]
});
```
Expand Down

0 comments on commit 6b1c350

Please sign in to comment.