Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Enderchief/esgleam
`esbuild` for Gleam (no NodeJS/Deno needed)
https://github.com/Enderchief/esgleam
Last synced: 27 days ago
JSON representation
`esbuild` for Gleam (no NodeJS/Deno needed)
- Host: GitHub
- URL: https://github.com/Enderchief/esgleam
- Owner: Enderchief
- License: apache-2.0
- Created: 2023-12-29T21:27:24.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-03-18T10:49:36.000Z (9 months ago)
- Last Synced: 2024-05-02T03:58:36.508Z (7 months ago)
- Language: Gleam
- Size: 83 KB
- Stars: 18
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gleam - esgleam - [📚](https://hexdocs.pm/esgleam/) - esbuild for Gleam (Packages / Build Tooling)
README
# esgleam
[![Package Version](https://img.shields.io/hexpm/v/esgleam)](https://hex.pm/packages/esgleam)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/esgleam/)*esbuild for Gleam that works on Erlang & JavaScript.*
## [Quick start](#quick-start)
1. Create a Gleam project as you would normally and make sure you have a file in `src` with the name of your project (as specified in `gleam.toml`)2. Install `esbuild`
```sh
gleam run -m esgleam/install
```3.
```sh
gleam run -m esgleam/bundle
```
See `/dist` for your bundled code4. To start a development server
```sh
gleam run -m esgleam/serve
```## [Advanced Usage](#advanced-usage)
(Follow steps 1-2)
3. Create `/src/build.gleam` with the following
```gleam
import esgleampub fn main() {
esgleam.new("./dist/static")
|> esgleam.entry("main.gleam")
|> esgleam.bundle
}
```See [esgleam](https://hexdocs.pm/esgleam/esgleam.html) for all config options and their default values.
5. Run your build script
```sh
gleam run -m build
```## [CLI overview](#cli-overview)
### Install
Install esbuild.
```sh
gleam run -m esgleam/install
```### Bundle
Bundle the project into a library with `src/{project_name}.gleam` as your entry point and `./dist/{project_name}.js` as your output file.
```sh
gleam run -m esgleam/bundle
```### App
Bundle the project into a single file to run with `src/{project_name}.gleam` as your entry point and `./dist/{project_name}.js` as your output file.
Similar to just running `gleam run`.
```sh
gleam run -m esgleam/app
```### Serve
Starts a dev server, serving the `dist` directory as `/`.
```sh
gleam run -m esgleam/serve
```## [Installation](#installation)
If available on Hex this package can be added to your Gleam project:
```sh
gleam add esgleam
```and its documentation can be found at .
## Roadmap
- [ ] Create file watcher for `*.gleam` which runs on both Erlang and JavaScript
- [ ] Fix bug with STDOUT/STDERR not being shown when running `esbuild` in the erlang target
- [ ] Write tests for config options
- [ ] Add more config options if needed
- [ ] Pseudo-SourceMaps until [#1341](https://github.com/gleam-lang/gleam/discussions/1341) merges
- [ ] Consider creating a way to use plugins
- [ ] Hot Module Reloading?????