Skip to content

Commit

Permalink
Add option "experimental_features"
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed Mar 4, 2021
1 parent 5c57e4c commit 02ddae1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 5 additions & 3 deletions source/app/metrics/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
const {queries} = conf
const data = {animated:true, base:{}, config:{}, errors:[], plugins:{}, computed:{}}
const imports = {plugins:Plugins, templates:Templates, metadata:conf.metadata, ...utils}
const experimental = new Set(decodeURIComponent(q["experimental.features"] ?? "").split(" ").map(x => x.trim().toLocaleLowerCase()).filter(x => x))

//Partial parts
{
Expand Down Expand Up @@ -64,9 +65,7 @@
//Optimize rendering
if ((conf.settings?.optimize)&&(!q.raw)) {
console.debug(`metrics/compute/${login} > optimize`)
console.debug(`metrics/compute/${login} > optimize > this feature is currently disabled due to display issues`)
const disabled = false
if (disabled) {
if (experimental.has("--optimize")) {
const {error, data:optimized} = await SVGO.optimize(rendered, {multipass:true, plugins:SVGO.extendDefaultPlugins([
//Additional cleanup
{name:"cleanupListOfValues"},
Expand All @@ -79,7 +78,10 @@
if (error)
throw new Error(`Could not optimize SVG: \n${error}`)
rendered = optimized
console.debug(`metrics/compute/${login} > optimize > success`)
}
else
console.debug(`metrics/compute/${login} > optimize > this feature is currently disabled due to display issues (use --optimize flag in experimental features to force enable it)`)
}
//Verify svg
if (verify) {
Expand Down
9 changes: 9 additions & 0 deletions source/plugins/core/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ inputs:
type: boolean
default: no

# Experimental features
experimental_features:
description: Experimental features
type: array
format: space-separated
default: ""
values:
- --optimize

# Use mocked data to bypass external APIs
use_mocked_data:
description: Use mocked data instead of live APIs
Expand Down

0 comments on commit 02ddae1

Please sign in to comment.