https://github.com/codewithkyle/twist
Give your vanilla JS a little twist.
https://github.com/codewithkyle/twist
Last synced: 5 months ago
JSON representation
Give your vanilla JS a little twist.
- Host: GitHub
- URL: https://github.com/codewithkyle/twist
- Owner: codewithkyle
- License: mit
- Created: 2021-03-27T19:07:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-10T13:07:40.000Z (over 2 years ago)
- Last Synced: 2025-04-07T01:39:32.641Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 135 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Twist
A simple build tool for wrangling your ES Module static import paths.
## Install
```bash
npm i -S @codewithkyle/twist
```
## Usage
By default we will look for JavaScript/TypeScript files in the `src/` directory and will output to the `public/js` directory. If you do not provide a `--config` flag we will use the default options based on the transpiler you've selected.
You can also provide the `--path` flag if you need to remap your imports to a CDN/external URL.
```bash
twist --src=./path-to/source --out=./public/js --type=esbuild --config=./esbuild.config.js --path='https://cdn.example.com/'
```
If you are using dynamic imports you can add the `--dynamic` flag.
### Build Types
- `none` the source code (JavaScript) will only be scrubbed & relocated.
- `tsc` the source code will be transpiled using the `typescript` package before being scrubbed and relocated.
- `esbuild` the source code will be transpiled using the `esbuild` package before being scrubbed and relocated.
- `babel` the source code will be transpired using the `@babel/core` pacakge before being scrubbed and relocated.
> **Note:** this library uses peer dependencies. You must install `typescript`, `esbuild`, or `@babel/core` to transpile the source code.