Skip to content

Commit

Permalink
fix: try to fix fonts url
Browse files Browse the repository at this point in the history
  • Loading branch information
ginifizz committed Oct 17, 2023
1 parent 34bf2b8 commit 153afd5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"prebuild": "node utils/clone-documentation.js",
"prebuild": "node utils/prebuild.js",
"export": "next export"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions public/site.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"short_name": "Vulcain",
"description": "Use HTTP/2 Server Push to create fast and idiomatic client-driven REST APIs",
"icons": [
{ "src": "/icon-192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "/icon-512.png", "type": "image/png", "sizes": "512x512" }
{ "src": "./icon-192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "./icon-512.png", "type": "image/png", "sizes": "512x512" }
]
}
10 changes: 8 additions & 2 deletions utils/clone-documentation.js → utils/prebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fs = require('fs-extra');

const rootPath = path.resolve(__dirname, '../');

async function cloneDocumentation() {
async function prebuild() {
try {
if (fs.existsSync(`${rootPath}/tempRepo`)) fs.removeSync(`${rootPath}/tempRepo`);
if (fs.existsSync(`${rootPath}/docs`)) fs.removeSync(`${rootPath}/docs`);
Expand All @@ -17,10 +17,16 @@ async function cloneDocumentation() {
await fs.copySync('tempRepo/README.md', `${rootPath}/docs/README.md`);
await fs.copySync('tempRepo/spec', `${rootPath}/spec`);
await fs.copySync('tempRepo/schemas', `${rootPath}/public/img/schemas`);

fs.removeSync('tempRepo');

// update css
const data = fs.readFileSync(`${rootPath}/styles/fonts.css`, 'utf8');
const modifiedData = data.replace(new RegExp('/fonts/', 'g'), `${process.env.NEXT_PUBLIC_BASE_URL || ''}/fonts/`);
fs.writeFileSync(`${rootPath}/styles/fonts.css`, modifiedData, 'utf8');
} catch (error) {
console.error(error);
}
}

cloneDocumentation();
prebuild();

0 comments on commit 153afd5

Please sign in to comment.