/webassets-elm

Filter for compiling Elm files using webassets

Primary LanguagePython

Elm filter for webassets

Status: Beta Latest release Python Version Downloads License

Travis CI Covearge Code Health

Filter for compiling Elm files using webassets.

Requirements

The elm-make binary has to be available from your system path. If it is not available you can:

  • Configure an alternative path to elm-make with the ELM_MAKE_BIN variable (e.g. node_modules/.bin/elm-make)
  • Install it globally using $ npm i -g elm or with any of these methods

Install

python -m pip webassets-elm

Basic usage

from webassets.filter import register_filter
from webassets_elm import Elm

register_filter(Elm)

Flask example

Using flask-assets:

from flask import Flask
from flask_assets import Bundle, Environment
from webassets.filter import register_filter
from webassets_elm import Elm

app = Flask(__name__)

register_filter(Elm)
assets = Environment(app)

elm_js = Bundle('elm/main.elm',
                filters=('elm',),
                output='app.js',
                depends='**/*.elm')
assets.register('elm_js', elm_js)

Django example

Using django-assets:

from django_assets import Bundle, register
from webassets.filter import register_filter
from webassets_elm import Elm

register_filter(Elm)

elm_js = Bundle('elm/main.elm',
                filters=('elm',),
                output='app.js',
                depends='**/*.elm')
register('elm_js', elm_js)

Contributing

Feel free to report an issue, open a pull request, or drop a line.

Don't forget to write and run tests:

python setup.py test

You need elm binaries available to run the tests. Install Elm and then the required packeges packages:

elm-package install

License

Copyright (c) 2016 Eduardo Cuducos

Licensed under the MIT License.