8000 GitHub - posthtml/posthtml-include at v1.0.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

posthtml/posthtml-include

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostHTML-include

npm version

Usage

index.html

<html>
<head>
    <title>index.html</title>
</head>
<body>
    <include src="component/button/button.html">
</body>
</html>

component/button/button.html

<button class="button"><div class="button__text">Button</div></button>
var posthtml = require('posthtml'),
    html = require('fs').writeFileSync('index.html').toString();

posthtml()
    .use(require('posthtml-include')({ encoding: 'utf-8' }))
    .process(html)
    .then(function(result) {
        console.log(result.html);
        //<html>
        //<head>
        //    <title>index.html</title>
        //</head>
        //<body>
        //    <button class="button"><div class="button__text">Text</div></button>
        //</body>
        //</html>
    })

Options

root: Root folder path for include. Default ./

encoding: Default utf-8

About

Include HTML Plugin

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 20

0