question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NodeJS approach to producing SVGs

See original GitHub issue

So what’s the feature? Some documented way to produce SVGs from state machines in Node.

Is this related to a problem? If so, what? The jssm-vis-demo, while good at quickly visualizing and getting started, is not useful for more serious work. Closing the browser windows destroys all progress. Describe the solution you’d like Currently, I’ve pulled the dot function out of src/ts/jssm-viz.ts in https://github.com/StoneCypher/jssm-viz/, and imported that function into my project for generating SVGs. I saved the code as js, removing the few ts type references. I then used spawn imported from child_process to run GraphViz’ dot executable on the .dot file I produce to get an svg. Describe alternatives you’ve considered I tried using jssm-viz, but it died without error messages in Node. Additional context as you see fit

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
StoneCyphercommented, Jan 6, 2020

This is now implemented in jssm-viz and the cli is mostly done

The github action is also mostly done

0reactions
StoneCyphercommented, Jan 27, 2020

Actually, there’s a live instance of jssm-viz bound to window on graph explorer, so you can just open a developer console and try it there

const viz = window.jssm_viz;
await viz.fsl_to_svg_string('this => is -> an ~> example;');

image

works in node too

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generating SVGs with RaphaelJS and NodeJS
So yeah, it's definitely simple to start generating SVGs from the server through Raphael, though the approach is quite hackish — and, to...
Read more >
Building SVGs in JavaScript with Pablo - LogRocket Blog
Learn how to use Pablo to create both simple and complex SVG shapes in JavaScript without compromising performance.
Read more >
svg/svgo: ⚙️ Node.js tool for optimizing SVG files - GitHub
Plugin Description Default mergeStyles merge multiple style elements into one enabled removeDoctype remove doctype declaration enabled removeXMLProcInst remove XML processing instructions enabled
Read more >
Love Generating SVG With JavaScript? Move It To The Server!
The solution is totally not production-ready, but it's OK for our experiment. Now we can run this example with node index.js . And...
Read more >
Using Express Static to serve SVG files - Stack Overflow
In order to serve svg1.svg to the client, I use app.use(express.static('svg_library')) . The client then has access at localhost:3000/svg1.svg ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found