-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.mjs
26 lines (18 loc) · 888 Bytes
/
build.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import fs from 'fs';
import VARS from './vars/general.json' with {type: 'json'};
/* vars.scss */
const doNotEditCommentScss = '// Generated file. DO NOT EDIT!\n\n';
// Loop through the vars and save a vars.scss file.
const varsValues = Object.entries(VARS)
.map(([key, value]) => `$${key}: ${value};`)
.join('\n');
fs.writeFileSync('scss/vars.scss', doNotEditCommentScss + varsValues);
/* general.css */
const doNotEditCommentCSS = '/* Generated file. DO NOT EDIT! */\n\n';
// Loop through the vars and save a general.scss file.
const generalValues = Object.entries(VARS)
.map(([key, value]) => `.${key} {\n color: ${value};\n}`)
.join('\n');
fs.writeFileSync('scss/general.css', doNotEditCommentCSS + generalValues);
/** Generate combined file for sophie build service */
fs.writeFileSync('scss/general.scss', doNotEditCommentCSS + varsValues + '\n\n' + generalValues);