Skip to content

Latest commit

 

History

History
49 lines (30 loc) · 1.35 KB

html-entry.md

File metadata and controls

49 lines (30 loc) · 1.35 KB

Using HTML Entrypoint

When you're using JavaScript files as entrypoints, Poi will inject generated files into an HTML template and then output that HTML template as index.html. However using an HTML file as entrypoint may be more straight-forward to many of you.

Luckily, you can do this with Poi too:

poi index.html --serve

It requires Poi 12.5.0 or above.

And you're good to go.

Features

Process local files

<link rel="stylesheet" href="./style.css">
<script src="https://polyfill.io/v3/polyfill.min.js?features=es2016"></script>
<script src="./main.js"></script>

Note that only relative paths will be processed by webpack, which means you can use absolute paths like https://... or /static/foo.css to reference external resources.

Process certain HTML attributes

It processes certain HTML attributes:

  • <img>: src
  • <image>: xlink:href
  • <video>: src poster
  • <source>: src
  • <link>: href
  • <script>: src

Reloading

Modifing HTML entry will trigger a full reload.

Template Interpolations

Your HTML entry will also be processed by lodash.template, see here for available template data.