Yes, see the docs on GitHub.
In your case, it might look like:
'assets' => 'assets',
'thumbs' => 'thumbs',
'site/static-template/favicon.ico' => 'favicon.ico',
'site/static-template/.htaccess-template' => '.htaccess'
(Just an example, the source paths can be anything you want, and the destination paths are the paths/filenames to use inside of the
You should make sure that the image is available in the static build (the contents of the
static folder should be self-sufficient), then provide a URL that works.
In this specific case, since the
site folder is not copied to the
static folder (and should not be!), even if the
$module->url() resolved to something sensible (no idea why it doesn't here), that would not be very helpful since you're not copying the site directory or even the module's directory (which probably contains some PHP you should not copy either).
If it's just images, my recommendation would be to make thumbs of the image so they end up — even as a pure copy with no image processing — in the
thumbs folder. Something like:
background-image: url("<?= $module->bgimage()->thumb()->url(); ?>");
If you have other resource you’re calling directly, be them JS or CSS or documents, I’m not sure what the right solutions would be. You can list specific files individually in the
'staticbuilder.assets', but if you have many it's going to be tedious and not future-proof.
By the way, in this example I'm supposing that
$module->bgimage() is an image object, but if it's a field where you wrote the filename of an image, you probably need to do something like this:
<?php if ($image = $module->bgimage()->toFile()): ?>
background-image: url("<?= $image->thumb()->url() ?>");
<?php endif ?>