dev-css-watcher.sh 1.1 KB

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. # CMD for the css-watcher dev container. Bind-mounts from compose.dev:
  3. # /build/assets, /build/views, /build/src, /build/public, tailwind.config.js
  4. # Output goes to /build/public/assets/css/app.css, which is the host's
  5. # public/assets/css/app.css (gitignored).
  6. set -eu
  7. # Vendor JS bundles never change between iterations — copy once on start
  8. # so a host bind-mount over public/assets/js/vendor stays populated.
  9. # `cp -u` skips when the destination is already up-to-date, so subsequent
  10. # container restarts are no-ops.
  11. mkdir -p public/assets/js/vendor
  12. cp -u node_modules/@alpinejs/csp/dist/cdn.min.js public/assets/js/vendor/alpine-csp.min.js
  13. cp -u node_modules/htmx.org/dist/htmx.min.js public/assets/js/vendor/htmx.min.js
  14. cp -u node_modules/sortablejs/Sortable.min.js public/assets/js/vendor/sortable.min.js
  15. # Direct binary path instead of `npx` — when the container runs as a
  16. # non-root host user (see compose.dev.yml `user:` directive), npx may try
  17. # to write to a $HOME it can't access. The locally-installed binary just
  18. # works.
  19. exec ./node_modules/.bin/tailwindcss \
  20. -i assets/css/input.css \
  21. -o public/assets/css/app.css \
  22. --watch