Coder Social home page Coder Social logo

esgleam's Introduction

esgleam

Package Version Hex Docs

esbuild for Gleam that works on Erlang & JavaScript.

  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

gleam run -m esgleam/install
gleam run -m esgleam/bundle

See /dist for your bundled code

  1. To start a development server
gleam run -m esgleam/serve

(Follow steps 1-2)

  1. Create /src/build.gleam with the following
import esgleam

pub fn main() {
   esgleam.new("./dist/static")
   |> esgleam.entry("main.gleam")
   |> esgleam.bundle
}

See esgleam for all config options and their default values.

  1. Run your build script
gleam run -m build

Install

Install esbuild.

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.

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.

gleam run -m esgleam/app

Serve

Starts a dev server, serving the dist directory as /.

gleam run -m esgleam/serve

If available on Hex this package can be added to your Gleam project:

gleam add esgleam

and its documentation can be found at https://hexdocs.pm/esgleam.

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 merges
  • Consider creating a way to use plugins
  • Hot Module Reloading?????

esgleam's People

Contributors

enderchief avatar xhh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.