| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #!/bin/bash
- set -e
- # build css and js files using esbuild
- # we don't install esbuild as a node npm package as we have simple needs.
- # we instead download a built executable of it, check this URL
- # <https://esbuild.github.io/getting-started/#other-ways-to-install>
- if hash ./esbuild 2>/dev/null; then
- echo "esbuild available! let's proceed..."
- echo ""
- # styles.css
- ./esbuild static/css/styles.css \
- --entry-names=[name]-[hash] \
- --bundle \
- --loader:.woff=file \
- --loader:.woff2=file \
- --asset-names=fonts/[name] \
- --target=chrome58,firefox57,safari11,edge16 \
- --outdir=static/dist
- # product.js
- ./esbuild static/js/product.js \
- --bundle \
- --entry-names=[name]-[hash] \
- --target=chrome58,firefox57,safari11,edge16 \
- --splitting \
- --format=esm \
- --outdir=static/dist
- # checkout.js
- ./esbuild static/js/checkout.js \
- --bundle \
- --entry-names=[name]-[hash] \
- --target=chrome58,firefox57,safari11,edge16 \
- --splitting \
- --format=esm \
- --outdir=static/dist
- echo ""
- echo "esbuild is done."
- else
- echo "Please download a build of esbuild from here"
- echo "https://esbuild.github.io/getting-started/#other-ways-to-install"
- echo "and place it in the root dir of this repo."
- fi
|