site: add offline support
parent
87163dfcd6
commit
9cca64da85
@ -0,0 +1,19 @@
|
||||
const glob = require('glob');
|
||||
const fs = require('fs');
|
||||
const { uniq } = require('lodash');
|
||||
|
||||
function getExternalResources() {
|
||||
let resources = [];
|
||||
const files = glob.sync('{./{components,docs}/**/*.md,./site/**/*.{less,js,jsx}}');
|
||||
files.forEach((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) {
|
||||
resources = resources.concat(matches);
|
||||
}
|
||||
});
|
||||
return uniq(resources);
|
||||
}
|
||||
|
||||
module.exports = getExternalResources;
|
@ -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 />;
|
Loading…
Reference in New Issue