The update externals plugin allows for updates to html files that need to reference external resources generated by lumbar.
The update externals plugin will automatically execute on any static files with
the .html or .htm extensions. This can be disabled by adding "update-externals": false
to the resource. Execution on files with other extensions can be enabled by
"update-externals": true
on the desired resource.
When enabled the plugin will update any <script>
and <link>
elements that reference
modules in the form of module:${name}
where ${name}
is the name of the module to
reference.
Combined modules may be loaded by setting the href
or src
attribute to any module
reference within the combined package.
Note that this plugin is required to use lumbar-loader
as this configures the lumbarLoadPrefix
variable.
For a html file with the following elements,
<link rel="stylesheet" type="text/css" href="base.css">
<link rel="stylesheet" type="text/css" href="module:base">
<script type="text/javascript" src="base.js"></script>
<script type="text/javascript" src="module:base"></script>
update-externals will generate the following output
<link rel="stylesheet" type="text/css" href="base.css">
<link rel="stylesheet" type="text/css" href="/r/phoenix/web/base.css">
<script type="text/javascript" src="base.js"></script>
<script type="text/javascript">var lumbarLoadPrefix = '/r/phoenix/web/';</script>
<script type="text/javascript" src="/r/phoenix/web/base.js"></script>