gulp-elm
raw JSON → 0.8.2 verified Fri May 01 auth: no javascript maintenance
Gulp plugin to compile Elm files using the Elm compiler. Version 0.8.2 supports Elm 0.19 only; earlier versions (0.7.x) support Elm 0.18. The plugin wraps Vinyl streams, providing `elm.make()` for single files and `elm.bundle()` for multiple entry files. Key options include `optimize`, `debug`, `cwd`, and custom `elm` binary path. Differentiators: simple integration with Gulp, bundle mode, and support for `--optimize` and `--debug` flags. Release cadence is sporadic, last updated in 2019.
Common errors
error Error: elm-make exited with code 1 ↓
cause Elm compilation error, possibly due to missing dependencies or syntax errors.
fix
Run
elm make manually to see full error output, or check elm.json and source files. error TypeError: elm is not a function ↓
cause Misunderstanding default import: using elm() instead of elm.make() or elm.bundle().
fix
Use elm.make(options) or elm.bundle(output, options) directly.
error Cannot find module 'gulp-elm' ↓
cause Package not installed or missing in node_modules.
fix
Run
npm install gulp-elm --save-dev. error The output file must be a string for elm.bundle() ↓
cause Missing or invalid output file argument to bundle.
fix
Pass a string as the first argument: elm.bundle('output.js', options).
Warnings
breaking Version 0.8.0 drops support for Elm 0.18 and earlier; use 0.7.x for those versions. ↓
fix For Elm 0.18, install gulp-elm@0.7.3.
gotcha The `cwd` option must point to the directory containing elm.json, not the source files. ↓
fix Set cwd to the project root, e.g., { cwd: './src' } if elm.json is there.
deprecated The `warn` option was removed in version 0.8.0. ↓
fix Use elm-make's native warning output; warnings appear on stderr.
gotcha Using `elm()` without specifying `make` or `bundle` is deprecated; use `elm.make()` explicitly. ↓
fix Always call elm.make() or elm.bundle() directly.
breaking Error messages changed format in 0.8.2; parsing errors may differ. ↓
fix Do not rely on exact error string formatting; check for error existence.
Install
npm install gulp-elm yarn add gulp-elm pnpm add gulp-elm Imports
- default wrong
const elm = require('gulp-elm')correctimport elm from 'gulp-elm' - make wrong
const make = require('gulp-elm').makecorrectimport { make } from 'gulp-elm' - bundle
import { bundle } from 'gulp-elm'
Quickstart
import gulp from 'gulp';
import elm from 'gulp-elm';
gulp.task('elm', () => {
return gulp.src('src/Main.elm')
.pipe(elm.make({ optimize: true }))
.pipe(gulp.dest('dist/'));
});
gulp.task('elm-bundle', () => {
return gulp.src('src/**/Main.elm')
.pipe(elm.bundle('bundle.js', { optimize: true }))
.pipe(gulp.dest('dist/'));
});