1.2.4 • Published 2 years ago

elm-vue-bridge v1.2.4

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

elm-vue-bridge

Bridge to render Elm modules in a Vue application

Renders Elm 0.19 modules within Vue 3. If you need to support Vue 2, please continue to use the previous major version.

npm npm GitHub Workflow Status (branch) NPM

Usage

Check out the docs for full explanation of how to use this package. For quick setup, read on!

Vite

# Install dependencies
npm install elm-vue-bridge
npm install --save-dev elm-tooling vite-plugin-elm 

# Initialize elm tooling
npx elm-tooling init
npx elm init

# Install elm and related tools
npx elm-tooling install

vite.config.js

import elmPlugin from "vite-plugin-elm";

export default {
  plugins: [elmPlugin()]
}

Vue CLI

Terminal

# Install dependencies
npm install elm-vue-bridge
npm install --save-dev elm-tooling elm-webpack-loader

# Initialize elm tooling
npx elm-tooling init
npx elm init

# Install elm and related tools
npx elm-tooling install

vue.config.js

module.exports = {
  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.elm$/,
          exclude: [/elm-stuff/, /node_modules/],
          use: { loader: "elm-webpack-loader", options: {} }
        }
      ]
    }
  }
};

Nuxt 3 (Vite enabled)

# Install dependencies
npm install elm-vue-bridge
npm install --save-dev elm-tooling vite-plugin-elm

# Initialize elm tooling
npx elm-tooling init
npx elm init

# Install elm and related tools
npx elm-tooling install

nuxt.config.ts

import { defineNuxtConfig } from "nuxt3";
import elmPlugin from "vite-plugin-elm";

// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
  vite: {
    plugins: [elmPlugin()],
  },
});

App.vue

<script setup>
import { Elm } from "./Main.elm";
import elmBridge from "./lib";

const Counter = elmBridge(Elm);
</script>

<template>
  <Counter />
</template>

You can also pass in flags and ports as props:

<template>
  <Counter :flags="flags" :ports="ports" />
</template>

License

This project is MIT Licensed.

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-beta.2

2 years ago

1.0.0-beta.3

2 years ago

1.0.0-beta.4

2 years ago

1.0.0-beta.5

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.0-beta.1

2 years ago

1.0.0-beta.6

2 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago