0.3.0 • Published 2 years ago

@prpl/plugin-html-imports v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@prpl/plugin-html-imports

A plugin for PRPL that resolves HTML import statements at build time.

The PRPL dev server is not yet aware of the graph of resources in your site and will not be able to detect changes in imported HTML files. Given that HTML imports is a deprecated specification, it's recommended to only use this plugin for fragments of HTML that you do not need live reloads of during development (for example, meta tags).

Dependencies

@prpl/plugin-html-imports has zero dependencies.

Usage

import { interpolate } from '@prpl/core';
import { resolveHTMLImports } from '@prpl/plugin-html-imports';

await interpolate();
await resolveHTMLImports();

Notes

Given HTML file hello-world.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <base href="/" />
    <link rel="import" href="meta.html" />
    <title>Hello world</title>
  </head>
  <body>
    <main class="index">
      <h1>Hello world</h1>
    </main>
  </body>
</html>

and an HTML fragment meta.html:

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />

and resolveHTMLImports is called, the output of HTML file hello-world.html will be:

<html lang="en">
  <head>
    <base href="/" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
    <title>Hello world</title>
  </head>
  <body>
    <main class="index">
      <h1>Hello world</h1>
    </main>
  </body>
</html>
0.3.0

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.1.0

3 years ago

0.2.1

3 years ago

0.1.2

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.4

3 years ago

0.2.2

3 years ago

0.1.3

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago