1.0.1 • Published 6 years ago

parcel-plugin-phtml v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

# parcel-plugin-phtml

Parcel plugin for load html file as string that use .phtml extension

Installation

npm install --save-dev parcel-plugin-phtml

Example

  • 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