Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make optimization settings overridable via the URL #174

Open
kaelig opened this issue Dec 2, 2019 · 2 comments · May be fixed by #209
Open

Make optimization settings overridable via the URL #174

kaelig opened this issue Dec 2, 2019 · 2 comments · May be fixed by #209

Comments

@kaelig
Copy link

kaelig commented Dec 2, 2019

As a developer trying to evangelize SVG optimization best practices, I'd like to be able to share a link to SVGOMG with pre-configured optimization settings that follow our best practices.

Perhaps with URL query parameters, for example: https://jakearchibald.github.io/svgomg/?removeDoctype=false?

@ptim
Copy link

ptim commented Sep 13, 2021

Awesome idea - relates to #11

@SethFalco
Copy link

SethFalco commented Nov 24, 2023

I'd be keen on this as well, but I'd propose a different implementation.

Rather than a query parameter per plugin, the site should accept two parameters:

  • config with the JSON config that SVGO accepts, this can be a URL parameter.
    • For the plugin array, will have to account for strings and objects with the name property, and ignore unknown plugin names or objects that don't match the schema.
  • svg which should be stored in the fragment instead of a query parameter.

If the config query parameter is specified, the webapp will parse and adapt that config to the interface.

If a fragment is specified and starts with svg=, the webapp will parse and initialize the workspace with that SVG. This will also make handling the request faster for large SVGs since it doesn't have to be sent to a server.

The reason for keeping the SVG in the fragment is for privacy/confidentiality. Clients like cURL or browsers never share the fragment with the webserver, which prevents users or employees from unintentionally leaking their SVG to the server.

The webapp can have a Get shareable link button, which populates the query parameters and fragment with the current workspace, and copies to clipboard. This allows for sharing the workspace without a database.

My use case is that I'd like for the SVGO documentation's demos to link to SVGOMG with the SVG and config for users to explore. Similar to what MDN does with having a Play button on each example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants