frontend.js
This file is optional. Most of the time, this is where we would write JS code specific to the block.
“most of the time” because some scripts might be shared and written inside other files.
If used, this file will be compiled to the [theme-root]/prod/block-specific/[block-name]/frontend.min.js
file that will be automatically enqueued on the front-end if the block is used. (Note that even if we use the same block multiple times, this file will be enqueued only once).
To learn how to share JS between blocks, go to this page.
If you are using our trb-cli
(“Theme Redone Blocks CLI”), this file will be created automatically upon each block creation.
To learn more, go ahead and read the trb-cli page.