Adds ELK (elkjs) to your app's JavaScript, for the
client-side auto layout (LiveFlow.Layout.prepare_layout_data/2 pushed as
lf:layout_data, or JS.dispatch("lf:auto-layout")).
ELK is optional because it adds about 1.6 MB to the bundle. The server-side
layouts (LiveFlow.Layout.tree/2, force/2) and the JS tree layout
(prepare_tree_layout_data/2) don't need it.
$ mix live_flow.gen.elk
The task:
copies elkjs to
assets/vendor/elk.bundled.cjsregisters it in
assets/js/app.js:import ELK from "../vendor/elk.bundled.cjs" import {registerElk} from "live_flow" registerElk(ELK)
Running it again is safe: an existing vendor file is kept (unless
--force) and app.js is changed only once.
Options
--assets- the assets directory (default:assets)--entry- the JS entry point, relative to the assets directory (default:js/app.js)--force- overwritevendor/elk.bundled.cjsif it exists--no-import- only copy the file, leave the entry point untouched
To use the npm package instead, run npm install elkjs --prefix assets and
register import ELK from "elkjs/lib/elk.bundled.js".