I was looking for using a library such as SVGO to clear the user-submitted SVG code on the front panel. SVGO is a library based on node.js that usually runs on the back, so I'm trying to wrap myself around the question of how to send SVG code from the front end to the background, and then clear the regurgitated code at the front end.
When I tried to figure this out, I checked their sample web application , which when running runs code inside related scripts, which I would normally see on the back of the front end. In particular, many of their functions have a signature ( full script ):
1: [function(require, module, exports) {
"use strict";
var loadScripts = require("./load-scripts"),
...
module.exports = exportedFunction;
}]
Pretty confusing, as it is usually, JS, which I connected with the backend, especially syntax require, module.exportsto name a few.
Question
- Is it just their entire library, SVGO, on the front side? Did they manually rewrite it for compatibility with the interface? Or is that what tools like browserfy are for?
- If so, what are the benefits of running it on the front panel and on the rear panel? Will it be simpler or are there some general guidelines for using where?
- At first glance it seems that it would be easier to just run the SVGO library in a browser and perform my conversion there (since I would not need to call the back end). What is the general practice?
Thank you for understanding. I am trying to make my project so that it makes sense / even down to web standards.