website/branding.js

55 lines
1.3 KiB
JavaScript
Raw Normal View History

const fs = require('fs');
const https = require('https');
function run() {
palette();
logo('large');
logo('small');
}
const paletteTemplate = `$palette1: #;
$palette2: #809640;
$palette3: #74873A;
$palette4: #617B30;
$palette5: #413D31;`
function palette() {
const options = {
hostname: 'git.birbmc.com',
port: 443,
path: '/Canopy/branding/raw/branch/main/palette.json',
method: 'GET'
}
const req = https.request(options, res => {
res.on('data', data => {
const palette = JSON.parse(data);
fs.writeFileSync('src/assets/sass/_palette.scss', `$palette1: #${palette[4]};
$palette2: #${palette[3]};
$palette3: #${palette[2]};
$palette4: #${palette[1]};
$palette5: #${palette[0]};`);
});
});
req.end();
}
function logo(size) {
fs.truncateSync(`src/images/${size}.svg`)
const options = {
hostname: 'git.birbmc.com',
port: 443,
path: `/Canopy/branding/raw/branch/main/${size}.svg`,
method: 'GET'
}
const req = https.request(options, res => {
res.on('data', data => {
fs.appendFileSync(`src/images/${size}.svg`, data);
});
});
req.end();
}
// Run the h*ckin' thing
if (require.main === module) {
run();
}