You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
728B

  1. const sass = require('sass');
  2. // TODO: Once configs are setup, make this section more dynamic!!
  3. var VARS = {
  4. COLOR_LIGHTER: "#fffcf2",
  5. COLOR_LIGHT: "#ccc5b9",
  6. COLOR_DARK: "#403d39",
  7. COLOR_DARKER: "#252422",
  8. COLOR_HIGHLIGHT: "#eb5e28",
  9. UI_SCALE: 1.0
  10. };
  11. function buildSASSVars(){
  12. let res = "";
  13. Object.keys(VARS).forEach((key)=>{
  14. res = res + "$" + key + ": " + VARS[key] + ";\n";
  15. });
  16. return res;
  17. }
  18. function render(entryfile){
  19. return new Promise((res, rej) => {
  20. let entry = buildSASSVars() + "@import '" + entryfile + "';\n";
  21. sass.render({data: entry, includePaths:['view/sass/']}, (err, data) => {
  22. if (err){rej(err);}
  23. res(data);
  24. });
  25. });
  26. }
  27. module.exports = {
  28. render
  29. };