-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tutorial6): refactor UI to work on localhost and localblockchain
- Loading branch information
1 parent
0b90b63
commit 5a617ac
Showing
25 changed files
with
1,986 additions
and
535 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
examples/zkapps/06-offchain-storage/offchain-storage-zkapp/ui/ghp-postbuild.js
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,25 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
// This script modifies the built CSS files and prepends the repo-name to the asset URLs. | ||
// to be compatible with GitHub Pages deployment. | ||
const cssDir = path.join(__dirname, '/out/_next/static/css'); | ||
// Update your repository name here if it is different from the project name. | ||
let repoURL = '06-zkapp-browser-ui'; | ||
const files = fs.readdirSync(cssDir); | ||
|
||
files.forEach((file) => { | ||
if (path.extname(file) === '.css') { | ||
const filePath = path.join(cssDir, file); | ||
|
||
const data = fs.readFileSync(filePath, 'utf8'); | ||
|
||
const singleQuoteRegex = new RegExp(`url\\(\\s*'\\/(?!${repoURL})`, 'g'); | ||
const doubleQuoteRegex = new RegExp(`url\\(\\s*"\\/(?!${repoURL})`, 'g'); | ||
|
||
let result = data.replace(singleQuoteRegex, `url('/${repoURL}/`); | ||
result = result.replace(doubleQuoteRegex, `url("/${repoURL}/`); | ||
|
||
fs.writeFileSync(filePath, result, 'utf8'); | ||
} | ||
}); |
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
Oops, something went wrong.