Skip to content

umijs/umi-plugin-gh-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

umi-plugin-gh-pages

NPM version NPM downloads

umi plugin to publish to Github Pages.

Usage

Configure in .umirc.js,

export default {
  ghPages:{
    dir:'dist',
    useCDN: false,
    getCDNUrl:(gitInfo)=>{return 'url'}
    ...gh-pages#PublishOptions
  }
}

ghPages

dir

exclude dir (default umi config outputPath), other options please checkout https://github.com/tschaub/gh-pages#options

useCDN

use CDN in publicPath ,default use jsdelivr - A free CDN for Open Source.

getCDNUrl

Custom CDN url.

Deploy in GitHub pages

config/config.ts

{
  ghPages: {
    useCDN: true,
  },
}
umi build

or

$GH_PAGES_USE_CDN=true umi build

Deploy in vercel (now)

config/config.ts

{
  ghPages: {
    branch: 'gh-pages',
    silent: true,
    repo: `https://${process.env.GH_TOKEN}@github.com/alitajs/alita-docs.git`,
  },
}

set the environment variables in vercel, with Production.

image

GH_TOKEN=[tokens]( 
https://github.com/settings/tokens)
GH_PAGES_USE_CDN=true

run the command

$ umi build

Examples

LICENSE

MIT

Other

如何优雅的使用 CDN 优化博客