https://github.com/jamen/dist-js
Create dist version of your JS.
https://github.com/jamen/dist-js
Last synced: 4 months ago
JSON representation
Create dist version of your JS.
- Host: GitHub
- URL: https://github.com/jamen/dist-js
- Owner: jamen
- License: mit
- Created: 2017-10-30T03:36:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-02T20:00:25.000Z (over 8 years ago)
- Last Synced: 2025-08-02T00:54:12.960Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# @jamen/dist-js
> Create dist version of your JS.
Combines tools for adding comptibility and optimizations to your JS compiler's
output.
```sh
$ dist-js dist/app.js
```
This will
- Run `babel` with `babel-preset-env`.
- Run `uglify-es`.
- Use sourcemaps when given input and output paths.
Also see [`@jamen/dist-css`](https://github.com/jamen/dist-css) for your CSS files.
## Install
```sh
$ npm i -D @jamen/dist-js
```
### `dist-js [file] [...options]`
The easiest way to use the tool is transforming a file in place:
```sh
$ dist-js dist/app.js
```
It will also detect when you want to use stdio:
```sh
# Using stdout
$ dist-js dist/app.js | wc -c
6780
# Using stdin
$ echo "console.log(1 + 2)" | dist-js dist/app.js
finished dist-js at dist/app.js
# Using both
$ echo "1 + 2" | dist-js > dist/app.js
```
Alternative to this, use the `--input`, `-i` and `--output`, `-o` flags, where
if a flag is absent it uses the stdio equivalent instead.
Also note that you can only accept a sourcemap with an input path, and write a
sourcemap with an output path. Inline sourcemaps are not supported out of
simplicity.
To disable sourcemaps regardless, supply the `--no-sourcemap` flag:
```sh
$ dist-js --no-sourcemap dist/app.js
```