Node-Red configuration
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.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env node
  2. // Patch to fix Font-Awesome urls for loading font
  3. // and to add in fa-sm(all) and fa-xs(extra small) modifiers
  4. var fs = require("fs");
  5. fs.readFile("node_modules/font-awesome/css/font-awesome.css", 'utf8', function (err, file) {
  6. if (err) { return; }
  7. else {
  8. console.log("Fixing up Font-Awesome css");
  9. var res1 = file.replace(/\?v=4\.7\../g, '');
  10. var res2 = res1.replace(/\&v=4\.7\../g, '');
  11. var res3;
  12. if (res2.indexOf("fa-sm ") === -1) {
  13. res3 = res2.replace(/fa-lg/, 'fa-sm {font-size:0.875em;}\n.fa-xs {font-size:0.75em;}\n.fa-lg');
  14. }
  15. else { res3 = res2; }
  16. fs.writeFile("node_modules/font-awesome/css/font-awesome.css", res3, 'utf8', function (err) {
  17. if (err) { console.log("Failed to re-write file."); }
  18. else {
  19. console.log("Fixed up Font-Awesome css");
  20. }
  21. });
  22. }
  23. });
  24. // Google-Material-Font
  25. // Fix relative path of fonts from `./fonts/` to `../fonts/` in css file.
  26. fs.readFile('node_modules/material-design-icons-iconfont/dist/material-design-icons.css', 'utf8', function (err, file) {
  27. if (err) { return; }
  28. else {
  29. console.log('Fixing up Google-Material-Font css');
  30. const res1 = file
  31. .replace(/"\.\/fonts\//g, '"../fonts/')
  32. .replace(/'\.\/fonts\//g, '\'../fonts/');
  33. fs.writeFile('node_modules/material-design-icons-iconfont/dist/material-design-icons.css', res1, 'utf8', function (err) {
  34. if (err) {
  35. console.log('Failed to re-write file.');
  36. } else {
  37. console.log('Fixed up Google-Material-Font css');
  38. }
  39. });
  40. }
  41. });