Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 5 gadiem
12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/node
  2. const fs = require('fs');
  3. const ejs = require('ejs');
  4. var DIR = process.argv[2];
  5. var TITLE = process.argv[3] || "Gallery";
  6. if(!DIR || !TITLE) {
  7. console.log(`### ERROR! No directory and/or title provided!`);
  8. console.log(`Usage: node gallery.js {directory} {title}`);
  9. process.exit(1);
  10. }
  11. // Prep data to be rendered
  12. var data = {}
  13. data.title = TITLE;
  14. data.images = [];
  15. // Image files
  16. var files = fs.readdirSync(DIR);
  17. for(let file of files) {
  18. if(!file.endsWith(".svg")) continue;
  19. data.images.push(file)
  20. }
  21. console.log(`### Generating gallery index.html for ${DIR}`);
  22. ejs.renderFile("templates/gallery.ejs", data, {}, function(err, outHtml){
  23. if(err) {
  24. console.log(err)
  25. } else {
  26. fs.writeFileSync(DIR + '/index.html', outHtml);
  27. }
  28. });