blob: c64da0ad867080a8e6f93acedab6774daa8508d2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/bin/bash
# This script is intended to be run from npm, via `npm run dist`
set -euo pipefail
HTMX_SRC="src/htmx.js"
# Clean the dist directory
rm -rf dist/*.js dist/*.ts dist/*.gz
# Regular IIFE script
cp $HTMX_SRC dist/htmx.js
# Generate minified script
uglifyjs -m eval -o dist/htmx.min.js dist/htmx.js
# Generate gzipped script
gzip -9 -k -f dist/htmx.min.js > dist/htmx.min.js.gz
# Generate AMD script
cat > dist/htmx.amd.js << EOF
define(() => {
$(cat $HTMX_SRC)
return htmx
})
EOF
# Generate CJS script
cat > dist/htmx.cjs.js << EOF
$(cat $HTMX_SRC)
module.exports = htmx;
EOF
# Generate ESM script
cat > dist/htmx.esm.js << EOF
$(cat $HTMX_SRC)
export default htmx
EOF
|