GithubHelp home page GithubHelp logo

srikanthkyatham / mix_gleam Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gleam-lang/mix_gleam

0.0 0.0 0.0 51 KB

⚗️ Build Gleam code with mix

License: Apache License 2.0

Elixir 98.27% Gleam 1.73%

mix_gleam's Introduction

MixGleam

Hex Package Hex Docs Licence Build

An Elixir archive that teaches Mix how to work with Gleam code and dependencies!

Installation

Install the Gleam compiler onto your machine. Installation instructions can be found here.

Install or update the MixGleam archive from Hex:

$ mix archive.install hex mix_gleam

To install or update from source:

$ mix archive.uninstall mix_gleam # if this archive was previously installed
$ git clone https://github.com/gleam-lang/mix_gleam.git
$ cd mix_gleam
$ MIX_ENV=prod mix do archive.build, archive.install

Configure your Mix project to use the MixGleam archive to work with Gleam's compiler and Gleam dependencies:

# in mix.exs
# ...
  @app :my_gleam_app

  def project do
    [
      app: @app,
      # ...
      archives: [mix_gleam: "~> 0.6.1"],
      compilers: [:gleam | Mix.compilers()],
      aliases: [
        # Or add this to your aliases function
        "deps.get": ["deps.get", "gleam.deps.get"]
      ],
      erlc_paths: [
        "build/dev/erlang/#{@app}/_gleam_artefacts",
        # For Gleam < v0.25.0
        "build/dev/erlang/#{@app}/build"
      ],
      erlc_include_path: "build/dev/erlang/#{@app}/include",
      # ...
    ]
  end
# ...

To see an entire example mix.exs file you can adapt to your existing Mix project:

$ mix gleam.new --retro

If you want to write Gleam code in your project, it's a good idea to add gleam_stdlib and gleeunit to your project's dependencies:

# in mix.exs
# ...
  defp deps do
    [
      # ...
      {:gleam_stdlib, "~> 0.28"},
      {:gleeunit, "~> 0.10", only: [:dev, :test], runtime: false},
      # ...
    ]
  end
# ...

Make a src directory for your Gleam code to live in:

$ mkdir src

And add the build directory to your .gitignore file so Gleam's build artefacts are not included in your project.

To run Gleam tests from the test/ directory with :gleeunit, you can run:

$ mix gleam.test

Example

Check the test project for an example that contains both Elixir and Gleam code. See the Elixir and Gleam test files to find examples on calling Gleam code from Elixir, and vice-versa.

mix_gleam's People

Contributors

tynanbe avatar lpil avatar modellurgist avatar michallepicki avatar andridus avatar silicium14 avatar miguel-s avatar phaleth avatar srikanthkyatham 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.