File: dist.sh

package info (click to toggle)
htmx 2.0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 96,944 kB
  • sloc: javascript: 65,214; ruby: 44; sh: 39; makefile: 7
file content (38 lines) | stat: -rwxr-xr-x 689 bytes parent folder | download | duplicates (2)
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