Skip to content

Commit e64f139

Browse files
botandrose-machinebotandrose
authored andcommitted
restore direct imports and add named export for ESM htmx extension.
1 parent 39b618f commit e64f139

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ the `dist/idiomorph-ext.js` file in your HTML:
189189
</div>
190190
```
191191

192+
or by importing the "idiomorph/htmx" module:
193+
194+
```html
195+
import "idiomorph/htmx";
196+
```
197+
192198
Note that this file includes both Idiomorph and the htmx extension.
193199

194200
#### Configuring Morphing Behavior in htmx

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919
"module": "dist/idiomorph.esm.js",
2020
"unpkg": "dist/idiomorph.min.js",
2121
"exports": {
22-
"require": "./dist/idiomorph.cjs.js",
23-
"import": "./dist/idiomorph.esm.js"
22+
".": {
23+
"require": "./dist/idiomorph.cjs.js",
24+
"import": "./dist/idiomorph.esm.js"
25+
},
26+
"./htmx": "./dist/idiomorph-ext.esm.js",
27+
"./dist/*": "./dist/*"
2428
},
2529
"scripts": {
2630
"test": "web-test-runner",
@@ -34,7 +38,7 @@
3438
"perf": "node perf/runner.js",
3539
"amd": "(echo \"define(() => {\n\" && cat src/idiomorph.js && echo \"\nreturn Idiomorph});\") > dist/idiomorph.amd.js",
3640
"cjs": "(cat src/idiomorph.js && echo \"\nmodule.exports = Idiomorph;\") > dist/idiomorph.cjs.js",
37-
"esm": "(cat src/idiomorph.js && echo \"\nexport {Idiomorph};\") > dist/idiomorph.esm.js",
41+
"esm": "(cat src/idiomorph.js && echo \"\nexport {Idiomorph};\") > dist/idiomorph.esm.js && (echo \"import htmx from \\\"htmx.org\\\";\n\" && cat dist/idiomorph-ext.js && echo \"\nexport {Idiomorph};\") > dist/idiomorph-ext.esm.js",
3842
"gen-modules": "npm run-script amd && npm run-script cjs && npm run-script esm",
3943
"dist": "cp -r src/* dist/ && cat src/idiomorph.js src/idiomorph-htmx.js > dist/idiomorph-ext.js && npm run-script gen-modules && npm run-script uglify && gzip -9 -k -f dist/idiomorph.min.js > dist/idiomorph.min.js.gz && exit",
4044
"uglify": "uglifyjs -m eval -o dist/idiomorph.min.js dist/idiomorph.js && uglifyjs -m eval -o dist/idiomorph-ext.min.js dist/idiomorph-ext.js",

0 commit comments

Comments
 (0)