website/branding.js

49 lines
1.1 KiB
JavaScript

const fs = require('fs');
const https = require('https');
function run() {
palette();
logo('large');
logo('small');
}
function palette() {
const options = {
hostname: 'git.jojodev.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.jojodev.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();
}