Sort static files just once.

Ref: #2075.