html-import-partials

1.0.1 • Public • Published

html-import-partials

Easily build a static html file by including html partials.

Usage

Install via npm

npm install html-import-partials

or yarn

yarn add html-import-partials

Command line:

$ html-import-partials src/*html -o dist

In Your File:

In the html file include a <include>. This tag will be replaced with the src you provide.

<include src='location/of/some/file.html'/>

Examples

Basic

Simply include the files where you want them

File: ./example/src/foo.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Foo</title>
</head>
<body>
    <h1>Welcome to my website</h1>
 
    <include src='partials/header.html'/>
</body>
</html>

File: ./example/src/partials/footer.html

<p>Footer here!!!</p>

Command: $ html-import-partials example/src/*html -o example/dist

Compiled file: ./example/dist/foo.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Foo</title>
</head>
<body>
    <h1>Welcome to my website</h1>
    
    <p>Footer here!!!</p>
</body>
</html>

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i html-import-partials

    Weekly Downloads

    45

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    7.08 kB

    Total Files

    9

    Last publish

    Collaborators

    • feliperrego