forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add offline support (ant-design#10738)
* site: add offline support * test update * Revert "test update" This reverts commit e1cb2fb. * use reduce
- Loading branch information
Showing
8 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const glob = require('glob'); | ||
const fs = require('fs'); | ||
const { uniq } = require('lodash'); | ||
|
||
function getExternalResources() { | ||
const files = glob.sync('{./{components,docs}/**/*.md,./site/**/*.{less,js,jsx}}'); | ||
const resources = files.reduce((acc, file) => { | ||
const content = fs.readFileSync(file, 'utf-8'); | ||
const pattern = new RegExp('(https://.+\\.alipayobjects\\.com/.+\\.(png|jpg|svg)|)', 'mg'); | ||
const matches = content.match(pattern); | ||
if (matches) { | ||
acc = acc.concat(matches); | ||
} | ||
return acc; | ||
}, []); | ||
return uniq(resources); | ||
} | ||
|
||
module.exports = getExternalResources; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Empty component for app shell | ||
* See https://github.com/NekR/offline-plugin/blob/master/docs/app-shell.md | ||
*/ | ||
import React from 'react'; | ||
|
||
export default () => <div />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters