Closed Visgean closed 10 years ago
I'd love to have a node.js version of this project - unfortunately I don't have a ton of time for side projects right now (this was kind of a fluke) so I probably won't be making those changes soon.
(I meant it as proposal for anyone who wants to contribute to this project but does not necessarily know what to do)
What do you mean by "node.js friendly"? This could be thrown onto a Node server like express incredibly easily – what features are you looking for? I'm not sure I know what you mean by "generate backgrounds on server side".
I think that Visgean means he'd like to see it packaged as a npm module with a CLI.
Yes that is what I meant. It is nothing that hard but there needs to be changes so it could be used like require('trianglify')..
Closed by a26e52ba51c139fba9071738c865e387da7ccb5a. There's no CLI, but I think that probably belongs in a separate module (trianglify-cli anyone?).
npm install trianglify
var Trianglify = require('trianglify');
t = new Trianglify();
console.log(t.generate(100, 100).svgString);
Beautiful – you beat me to it! :)
Did you succeed at saving that data as file?
var fs = require('fs'); var Trianglify = require('trianglify');
var t = new Trianglify(); var image_data = t.generate(800, 600).svgString;
fs.writeFile('filename', image_data, function(err) { if(err) { console.log(err); } else { console.log("The file was saved!"); } });
did not work, the data saved is not standard svg format...
jsdom is generating a self-closing
Can you post your output?
https://gist.github.com/Visgean/10831242
@qrohlf yes the capitalization of the svg and path tags was the problem
So for anyone else interested: you can have your wallpaper changed automatically: https://gist.github.com/Visgean/10847362
Capitalization issue fixed in 5089a9758a6c44f40260ca5de2b2f44cfce7fe76
Was this removed?
With node.js friendly version one could use this to generate backgrounds on server side or on desktop.
D3 is already in NPM so it should not be that hard.
I tried to do it myself but I do not really now node.js that well