Volt.HTMLEntry (Volt v0.10.0)

Copy Markdown View Source

Extract entry points from HTML files.

Parses <script src="..."> and <link rel="stylesheet" href="..."> tags using Floki to discover JS and CSS entry files.

Example

# index.html
<script type="module" src="js/app.ts"></script>
<link rel="stylesheet" href="css/app.css">

{:ok, entries} = Volt.HTMLEntry.extract("index.html")
entries.scripts  #=> ["js/app.ts"]
entries.styles   #=> ["css/app.css"]

Summary

Functions

Extract script and stylesheet entries from an HTML file.

Check if a path is an HTML file.

Functions

extract(html_path)

@spec extract(String.t()) :: {:ok, %{scripts: [String.t()], styles: [String.t()]}}

Extract script and stylesheet entries from an HTML file.

Paths are resolved relative to the HTML file's directory.

html?(path)

@spec html?(String.t()) :: boolean()

Check if a path is an HTML file.