Closed bholloway closed 4 years ago
Thanks @runfaj.
My gut feel is that it is better than what we have at v3 but probably needs some tweaks or changes before release.
I will write up some better docs for the whole package and I think this will draw out any major problems.
concept
The aim is to produce a
factory
which orders the possible base directories and apredicate
which tests the base directories. The separation of concerns should make it easier to order or possible base directories without changing the predicate.The
factory
is given the possiblebases
as hash. So it can arbitrarily set the precedence ofsubString
,value
,property
,selector
source-map locations and returnArray<string>
.The
factory
should be lazy since it might traverse the file-system search in order to suggest base paths. In that case we would want to abort if thepredicate
matches. It can optionally returnIterator<string>
.The
predicate
is largely unchanged. However it now usesfs
from Webpack. This should solve any lingering issues we webpack-dev-server (untested).changes
factory
andpredicate
factory
to allow explicit ordering of precedencepredicate
to useloader.fs
join-function.js
examples
Considering the example given by @MightyPork in this comment.
We can now add a fallback theme directory with minimum code.