const sass = require('sass'); // TODO: Once configs are setup, make this section more dynamic!! var VARS = { COLOR_LIGHTER: "#fffcf2", COLOR_LIGHT: "#ccc5b9", COLOR_DARK: "#403d39", COLOR_DARKER: "#252422", COLOR_HIGHLIGHT: "#eb5e28", UI_SCALE: 1.0 }; function buildSASSVars(){ let res = ""; Object.keys(VARS).forEach((key)=>{ res = res + "$" + key + ": " + VARS[key] + ";\n"; }); return res; } function render(entryfile){ return new Promise((res, rej) => { let entry = buildSASSVars() + "@import '" + entryfile + "';\n"; sass.render({data: entry, includePaths:['view/sass/']}, (err, data) => { if (err){rej(err);} res(data); }); }); } module.exports = { render };