Resources (css & js files)
The Resources component handles resources. The ResourceSorter component helps you sort them to deliver to the page in the order you need.
Sorting
Basically, just:
$lia->setResourceOrder('css', ['five.css', 'one.css', 'two.css', 'specificdir/three.css', 'otherdir/three.css', 'butactually/five.css']);
- The files will be delivered in the order they're declared in the array.
- the file at
butactually/five.css
will be the 5th css file delivered.- Since the longer relative path is specified, the shorter one (
'five.css'
is ignored). -
'five.css'
could still be relevant if there's a differentfive.css
file in a different directory.
- Since the longer relative path is specified, the shorter one (
- There are two
three.css
files. Imagine we replaced'specificdir/three.css', 'otherdir/three.css'
and only put'three.css'
- There's no guarantee which
three.css
file would come first in the output - both
three.css
files would be AFTERtwo.css
and BEFOREbutactually/five.css
- There's no guarantee which