Skip to content

Conversation

kellymears
Copy link
Contributor

@kellymears kellymears commented Dec 29, 2021

Type of change

  • MINOR: feature

Dependencies added

  • none

Details

Can specify the emitHtml option to generate an html file with the <script>, <style> tags and the inlined runtime per entrypoint.

Example:

// ...webpack config
plugins: [
  // ... other plugins
  new EntrypointsWebpackPlugin({emitHtml: true})
]

In the case of @roots/bud-entrypoints this looks like:

bud.extensions.get('@roots/bud-entrypoints').setOption('emitHtml', true)

emits app.html:

<script>
/** inlined runtime */
</script>
<script src="/app/themes/sage/public/app.67d1d3.js" type="defer"></script>
<link rel="stylesheet" href="/app/themes/sage/public/app.8083ce.css" />

Obvious advantage: barring a more sophisticated way of parsing entrypoints.json, a project can do something like a php require of this file and be done with it.

@kellymears kellymears self-assigned this Dec 29, 2021
@kellymears kellymears merged commit 9421027 into next Dec 29, 2021
@kellymears kellymears deleted the entrypoints-html-emit branch December 29, 2021 22:28
@kellymears kellymears mentioned this pull request Jan 4, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants