1.0.1 • Published 5 years ago

html-gxb-layout-loader v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

html-gxb-layout-loader

simple html layout loader for webpack

Install

npm install html-gxb-layout-loader

Required

node > 8.0

Usage

  • First, you need a layout html, like this:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Pure Web</title>
  <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
</head>
<body>
  <header>This is Header</header>

  <!-- the place of the content will be inserted, you can change the placeholder in loader options-->
  {{__content__}}

  <footer>This is footer</header>
</body>
</html>
  • Second
    setting default layout in loader options, so you don't do any thing in html
    ```html
    <div class="main">
      main content
    </div>
    {
      test: /\.(html)$/,
      loader: 'html-gxb-layout-loader',
      include: htmlPath, // the htmls you want inject to layout
      options: {
        layout: layoutHtmlPath // the path of default layout html
      }
    }