mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
feat(generator): add nojekyll option (#8813)
Co-authored-by: Xin Du (Clark) <clark.duxin@gmail.com>
This commit is contained in:
parent
931d1cf89e
commit
380ffb6481
@ -8,6 +8,7 @@ export default () => ({
|
|||||||
fallback: '200.html',
|
fallback: '200.html',
|
||||||
crawler: true,
|
crawler: true,
|
||||||
manifest: true,
|
manifest: true,
|
||||||
|
nojekyll: true,
|
||||||
cache: {
|
cache: {
|
||||||
ignore: [],
|
ignore: [],
|
||||||
globbyOptions: {
|
globbyOptions: {
|
||||||
|
@ -218,6 +218,7 @@ Object {
|
|||||||
"fallback": "200.html",
|
"fallback": "200.html",
|
||||||
"interval": 0,
|
"interval": 0,
|
||||||
"manifest": true,
|
"manifest": true,
|
||||||
|
"nojekyll": true,
|
||||||
"routes": Array [],
|
"routes": Array [],
|
||||||
"staticAssets": Object {
|
"staticAssets": Object {
|
||||||
"base": "/_nuxt/static",
|
"base": "/_nuxt/static",
|
||||||
|
@ -193,6 +193,7 @@ Object {
|
|||||||
"fallback": "200.html",
|
"fallback": "200.html",
|
||||||
"interval": 0,
|
"interval": 0,
|
||||||
"manifest": true,
|
"manifest": true,
|
||||||
|
"nojekyll": true,
|
||||||
"routes": Array [],
|
"routes": Array [],
|
||||||
"staticAssets": Object {
|
"staticAssets": Object {
|
||||||
"base": undefined,
|
"base": undefined,
|
||||||
@ -578,6 +579,7 @@ Object {
|
|||||||
"fallback": "200.html",
|
"fallback": "200.html",
|
||||||
"interval": 0,
|
"interval": 0,
|
||||||
"manifest": true,
|
"manifest": true,
|
||||||
|
"nojekyll": true,
|
||||||
"routes": Array [],
|
"routes": Array [],
|
||||||
"staticAssets": Object {
|
"staticAssets": Object {
|
||||||
"base": undefined,
|
"base": undefined,
|
||||||
|
@ -267,8 +267,10 @@ export default class Generator {
|
|||||||
|
|
||||||
// Add .nojekyll file to let GitHub Pages add the _nuxt/ folder
|
// Add .nojekyll file to let GitHub Pages add the _nuxt/ folder
|
||||||
// https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/
|
// https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/
|
||||||
|
if (this.options.generate.nojekyll) {
|
||||||
const nojekyllPath = path.resolve(this.distPath, '.nojekyll')
|
const nojekyllPath = path.resolve(this.distPath, '.nojekyll')
|
||||||
await fsExtra.writeFile(nojekyllPath, '')
|
await fsExtra.writeFile(nojekyllPath, '')
|
||||||
|
}
|
||||||
|
|
||||||
await this.nuxt.callHook('generate:distCopied', this)
|
await this.nuxt.callHook('generate:distCopied', this)
|
||||||
await this.nuxt.callHook('export:distCopied', this)
|
await this.nuxt.callHook('export:distCopied', this)
|
||||||
|
@ -182,6 +182,7 @@ describe('generator: initialize', () => {
|
|||||||
test('should initialize destination folder', async () => {
|
test('should initialize destination folder', async () => {
|
||||||
const nuxt = createNuxt()
|
const nuxt = createNuxt()
|
||||||
nuxt.options.generate.fallback = 'fallback.html'
|
nuxt.options.generate.fallback = 'fallback.html'
|
||||||
|
nuxt.options.generate.nojekyll = true
|
||||||
const generator = new Generator(nuxt)
|
const generator = new Generator(nuxt)
|
||||||
fsExtra.exists.mockReturnValueOnce(false)
|
fsExtra.exists.mockReturnValueOnce(false)
|
||||||
|
|
||||||
|
1
packages/types/config/generate.d.ts
vendored
1
packages/types/config/generate.d.ts
vendored
@ -18,6 +18,7 @@ export interface NuxtOptionsGenerate {
|
|||||||
exclude?: RegExp[]
|
exclude?: RegExp[]
|
||||||
fallback?: string | boolean
|
fallback?: string | boolean
|
||||||
interval?: number
|
interval?: number
|
||||||
|
nojekyll?: boolean
|
||||||
routes?: NuxtOptionsGenerateRoute[] | NuxtOptionsGenerateRoutesFunction | NuxtOptionsGenerateRoutesFunctionWithCallback
|
routes?: NuxtOptionsGenerateRoute[] | NuxtOptionsGenerateRoutesFunction | NuxtOptionsGenerateRoutesFunctionWithCallback
|
||||||
subFolders?: boolean
|
subFolders?: boolean
|
||||||
cache?: false | {
|
cache?: false | {
|
||||||
|
Loading…
Reference in New Issue
Block a user