Skip to content

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

License

Notifications You must be signed in to change notification settings

lplus/parcel-plugin-phtml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# 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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published