Sort static files just once.

Ref: #2075.
Would this ever have a `nil` value? Just curious about the `compact`.