https://github.com/bwireman/esgleam
esbuild plugin for gleam 🌸
https://github.com/bwireman/esgleam
bundler esbuild gleam javascript minifier plugin
Last synced: 11 months ago
JSON representation
esbuild plugin for gleam 🌸
- Host: GitHub
- URL: https://github.com/bwireman/esgleam
- Owner: bwireman
- License: mit
- Created: 2022-03-26T16:41:37.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T13:00:52.000Z (over 3 years ago)
- Last Synced: 2024-11-17T11:53:59.714Z (over 1 year ago)
- Topics: bundler, esbuild, gleam, javascript, minifier, plugin
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/esgleam
- Size: 80.1 KB
- Stars: 19
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esgleam
An [esbuild](https://esbuild.github.io/) plugin for [gleam](https://gleam.run/) ✨
[](https://www.npmjs.com/package/esgleam)
[](https://www.npmjs.com/package/esgleam)
[](https://github.com/bwireman/esgleam/commit/main)
[](https://github.com/bwireman/esgleam/blob/main/LICENSE)
[](https://gleam.run/news/v0.16-gleam-compiles-to-javascript/)
[](http://makeapullrequest.com)
---
Gleam is a beautiful little language that compiles to JS and to Erlang. Esbuild is an excellent little js bundler. It's a great match! 🌸
## Usage
```shell
# install
npm i --save-dev esgleam esbuild
# or
yarn add --dev esgleam esbuild
```
in conjunction with esbuild
> more info @ https://esbuild.github.io/plugins/#using-plugins
```javascript
// add to your esbuild config file
import esbuild from "esbuild"
import esgleam from "esgleam"
esbuild.build({
entryPoints: ['./src/main.gleam'],
bundle: true,
outfile: 'out.js',
plugins: [esgleam.esgleam({ main_function: "main", project_root: "." })],
}).catch(() => process.exit(1))
```
### Options
```typescript
export interface EsGleamOptions {
// path to the root of the gleam project
// default: "."
project_root?: string;
// if defined the output file will call this function with no args
// useful for bundled js files
main_function?: string;
// other flags to be passed to the gleam compiler
compile_args?: string[];
}
```