Add AMD distribution

This commit is contained in:
Alexander Petros
2023-12-21 12:39:07 -05:00
parent e96037c4ed
commit 54c89e4e3e
3 changed files with 3638 additions and 1 deletions

View File

@@ -8,7 +8,7 @@ HTMX_SRC=src/htmx.js
rm -rf dist/*
# Regular IIFE script
cp $HTMX_SRC dist/
cp $HTMX_SRC dist/htmx.js
# Minified script
uglifyjs -m eval -o dist/htmx.min.js dist/htmx.js
@@ -16,6 +16,14 @@ uglifyjs -m eval -o dist/htmx.min.js dist/htmx.js
# Gzipped script
gzip -9 -k -f dist/htmx.min.js > dist/htmx.min.js.gz
# AMD script
cat > dist/htmx.amd.js << EOF
define(() => {
$(cat $HTMX_SRC)
return htmx
})
EOF
# CJS script
cat > dist/htmx.cjs.js << EOF
$(cat $HTMX_SRC)