@licq/site-cdn
v1.0.1
Published
主要用于静态站点的静态资源走cdn,比如hexo、vuepress
Downloads
1
Readme
@licq/site-cdn
主要用于静态站点的静态资源走cdn,比如hexo、vuepress
安装
npm i --save-dev @licq/site-cdn
API
siteCdn
替换vuepress
、hexo
等构建产物里html的静态资源路径, 拼接cdn
Returns: undefined
Since: v1.0.0
| Param | Type | Description | | --- | --- | --- | | dist | fs.PathLike | 构建产物绝对路径 | | base | String | 静态资源前缀 eg: '/' | '/blog/' | | cdn | String | cdn地址 eg: 'https://demo.cdn.com/blog/' |
Example
const siteCdn = require('@licq/site-cdn')
siteCdn('/Users/xxx/path/to/vuepress/dist', '/blog/', 'https://demo.cdn.com/')
//==> undefined
Example
// eg: xxx.html ===>
// - <script type="module" src="/blog/assets/app.7bfa9b79.js" defer></script>
// + <script type="module" src="https://demo.cdn.com/blog/assets/app.7bfa9b79.js" defer></script>
// - <link rel="stylesheet" href="/blog/assets/style.c2b7e6ed.css">
// + <link rel="stylesheet" href="https://demo.cdn.com/blog/assets/style.c2b7e6ed.css">
// - <img class="logo" src="/blog/assets/ost-hourse.png" alt="Ostwindli's Asenal">
// + <img class="logo" src="https://demo.cdn.com/blog/assets/ost-hourse.png" alt="Ostwindli's Asenal">