electrum-require-components
This tool synthesizes a source file with a list of requires.
electrum-require-components --wrap --crlf ./src widgets .component.js all.js
Produces file ./src/all.js
while recursively exploring folder widgets
found in the source folder ./src
, looking for *.component.js
.
- The
--wrap
option inserts calls toElectrum.wrap()
. - The
--crlf
option uses CR+LF line endings (for Windows files).
Here is an example of a resulting source file with --wrap
:
;;const CheckBox = Electrum;const Panel = Electrum;
And the same example without --wrap
:
;const CheckBox = _CheckBox;const Panel = _Panel;
Note how
check-box
produces an export namedCheckBox
.
Companion files
If there are companion files (e.g. panel.styles.js
located beside
the panel.component.js
file), then they will also get imported and
provided to Electrum.wrap
as an additional argument:
;;;;const Panel = Electrum;