Uxtely

Best Practices
Deploy Assets Before Documents

by Eric Fortis

When deploying, there's a tiny window in which users could fetch a new document while its images, CSS, or JS are still being uploaded. This results in broken or unstyled pages, not to be confused with FOUCs.

As the problem is an uncoordinated deployment, one way to prevent those issues is by nesting the assets in subdirectories:

  • index.html
  • static/foo.js
  • images/bar.png

…and deploying in two steps:

# Subdirectories first
rsync -r --include '*/' --exclude '/*' $SRC/ $DEST/

# Then the top level files (HTML documents)
rsync --times $SRC/* $DEST

Sponsored by: