Skip to content

Commit

Permalink
add bootstrap from source instead of bundling it in code
Browse files Browse the repository at this point in the history
sylviiu committed Oct 30, 2023
1 parent a881478 commit 41f6668
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -10,4 +10,5 @@ build-*.json
minified.js
html/assets/fonts/
html/assets/css/Alata.css
html/assets/bootstrap/
res/trayIcons/
22 changes: 22 additions & 0 deletions build/scripts/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const fs = require('fs');

// dest path: assets/css/Alata.css
// fonts path: assets/fonts/

module.exports = {
beforePack: () => {
if(fs.existsSync(`./html/assets/bootstrap`)) fs.rmSync(`./html/assets/bootstrap`, { recursive: true, force: true });

fs.mkdirSync(`./html/assets/bootstrap`);
fs.mkdirSync(`./html/assets/bootstrap/css`);
fs.mkdirSync(`./html/assets/bootstrap/js`);

const cssfile = fs.readFileSync(`./node_modules/bootstrap/dist/css/bootstrap.min.css`, `utf8`);
fs.writeFileSync(`./html/assets/bootstrap/css/bootstrap.min.css`, cssfile);
console.log(`saved css file`);

const jsfile = fs.readFileSync(`./node_modules/bootstrap/dist/js/bootstrap.min.js`, `utf8`);
fs.writeFileSync(`./html/assets/bootstrap/js/bootstrap.min.js`, jsfile);
console.log(`saved js file`);
},
}
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@
"@fontsource/alata": "^5.0.8",
"@fortawesome/fontawesome-free": "^6.4.2",
"animejs": "^3.2.1",
"bootstrap": "^5.3.2",
"color-scheme": "^1.0.1",
"electron": "^26.3.0",
"electron-builder": "^24.6.4",

0 comments on commit 41f6668

Please sign in to comment.