idiomorph icon indicating copy to clipboard operation
idiomorph copied to clipboard

htmx extension without globals

Open silverwind opened this issue 1 year ago • 0 comments

The htmx init code here relies on a htmx global: https://github.com/bigskysoftware/idiomorph/blob/8e40c42cc573609eb6863e72fa3403574974dd7d/src/idiomorph-htmx.js#L12

While reliance on globals is probably okay with <script> usage, in a scenario with a bundler it is not necessary and undesired to have any globals. How about allowing something like this?

import htmx from 'htmx.org';
import idiomorph from 'idiomorph/dist/idiomorph-ext-bundler.min.js';
htmx.defineExtension('morph', idiomorph);

Related: https://github.com/bigskysoftware/htmx/issues/1690

silverwind avatar Feb 14 '24 21:02 silverwind