@licq/site-cdn

1.0.1 • Public • Published

@licq/site-cdn

主要用于静态站点的静态资源走cdn,比如hexo、vuepress

NPM version NPM downloads

安装

npm i --save-dev @licq/site-cdn

API

siteCdn

替换vuepresshexo等构建产物里html的静态资源路径, 拼接cdn

Returns: undefined
Since: v1.0.0

Param Type Description
dist fs.PathLike 构建产物绝对路径
base String 静态资源前缀 eg: '/'
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">

/@licq/site-cdn/

    Package Sidebar

    Install

    npm i @licq/site-cdn

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    6.46 kB

    Total Files

    5

    Last publish

    Collaborators

    • uv-w