modulepreload

1.1.0 • Public • Published

modulepreload

Inject modulepreload tags into HTML.

$ npm install --save-dev modulepreload
$ npx modulepreload inject -w index.html

Before injection:

<!-- index.html -->
<html>
<head>
    <title>Example</title>
</head>
<body>
    <script type="module">
        import './dep.js'; // imports ./another-dep.js
    </script>
</body>
</html>

After injection:

<!-- index.html -->
<html>
<head>
    <title>Example</title>
    <link rel="modulepreload" href="/dep.js" />
    <link rel="modulepreload" href="/another-dep.js" />
</head>
<body>
    <script type="module">
        import './dep.js'; // imports ./another-dep.js
    </script>
</body>
</html>

/modulepreload/

    Package Sidebar

    Install

    npm i modulepreload

    Weekly Downloads

    4

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    9.33 kB

    Total Files

    13

    Last publish

    Collaborators

    • dpikt