# parcel-plugin-phtml
Parcel plugin for load html file as string that use .phtml extension
npm install --save-dev parcel-plugin-phtml
-
my-component.phtml
<my-component> lorem ipsum</my-component>
-
index.js
import html from './my-component.phtml'; console.log(html);
-
index.html
<!DOCTYPE html> <html> <head> <title>parcel-plugin-phtml demo</title> </head> <body> <h1>parcel-plugin-phtml demo</h1> <p>see your browser's console</p> <script type="text/javascript" src="index.js"></script> </body> </html>
-
.posthtmlrc
{ "plugins": { "posthtml-custom-elements": {} } }
parcel index.html
-
output
<div class="my-component"> test post-html </div>
good luck