require_glob
require_glob()
recursively loads .js
files that match a glob (wildcard). The recursion can be disabled.
Possible parameters are:
Path as string, where you would like to start including files. Mandatory. Pattern matching possible, see GoLand path/filepath/#Match docs.
If being recursive. This is a boolean if the search should be recursive or not. Define either
true
orfalse
. Default istrue
.
Example to load .js
files recursively:
dnsconfig.js
Example to load .js
files only in domains/
:
dnsconfig.js
Comparison to require()
require_glob()
and require()
both use the same rules for determining which directory path is relative to.
This will load files being present underneath ./domains/user1/
and NOT at below ./domains/
, as require_glob()
is called in the subfolder domains/
.
dnsconfig.js
domains/index.js
Last updated