1.0.7 • Published 6 years ago

public-header-copy v1.0.7

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

public-header

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