public-header

1.0.3 • Public • Published

public-header

NPM Version Coverage Status Build Status Downloads Dependency Status License

pubilc header handler for DataGrand.com

Install

npm i -D public-header

Usage

在项目根目录写入script.js

import publicHeader from "public-header"

publicHeader // true

在项目根目录配置public.json

{
  "header": {
    "template": true,
    "style": false,
    "script": false,
    "src": "index.html" // todo: smart match files
  },
  "dgcsm": {}, //todo
  "footer": {} //todo
}

HTML 模板

<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <!--start:header-style-->
  <!--end:header-style-->
</head>
<body>
  <!--start:header-template-->
  <!--end:header-template-->
  <!--start:header-script-->
  <!--end:header-script>
</body>
</html>

目前只能匹配单个文件,只能一次插入,实验性质,其他功能正在补全。请在个人实验项目中试用!

TODO:

  • delete
  • replace
  • dev & product 环境
  • CDN
  • smart match files

License

MIT © younixiao

Readme

Keywords

none

Package Sidebar

Install

npm i public-header

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • younixiao