Add option "experimental_features"
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
const {queries} = conf
|
const {queries} = conf
|
||||||
const data = {animated:true, base:{}, config:{}, errors:[], plugins:{}, computed:{}}
|
const data = {animated:true, base:{}, config:{}, errors:[], plugins:{}, computed:{}}
|
||||||
const imports = {plugins:Plugins, templates:Templates, metadata:conf.metadata, ...utils}
|
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
|
//Partial parts
|
||||||
{
|
{
|
||||||
@@ -64,9 +65,7 @@
|
|||||||
//Optimize rendering
|
//Optimize rendering
|
||||||
if ((conf.settings?.optimize)&&(!q.raw)) {
|
if ((conf.settings?.optimize)&&(!q.raw)) {
|
||||||
console.debug(`metrics/compute/${login} > optimize`)
|
console.debug(`metrics/compute/${login} > optimize`)
|
||||||
console.debug(`metrics/compute/${login} > optimize > this feature is currently disabled due to display issues`)
|
if (experimental.has("--optimize")) {
|
||||||
const disabled = false
|
|
||||||
if (disabled) {
|
|
||||||
const {error, data:optimized} = await SVGO.optimize(rendered, {multipass:true, plugins:SVGO.extendDefaultPlugins([
|
const {error, data:optimized} = await SVGO.optimize(rendered, {multipass:true, plugins:SVGO.extendDefaultPlugins([
|
||||||
//Additional cleanup
|
//Additional cleanup
|
||||||
{name:"cleanupListOfValues"},
|
{name:"cleanupListOfValues"},
|
||||||
@@ -79,7 +78,10 @@
|
|||||||
if (error)
|
if (error)
|
||||||
throw new Error(`Could not optimize SVG: \n${error}`)
|
throw new Error(`Could not optimize SVG: \n${error}`)
|
||||||
rendered = optimized
|
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
|
//Verify svg
|
||||||
if (verify) {
|
if (verify) {
|
||||||
|
|||||||
@@ -178,6 +178,15 @@ inputs:
|
|||||||
type: boolean
|
type: boolean
|
||||||
default: no
|
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 to bypass external APIs
|
||||||
use_mocked_data:
|
use_mocked_data:
|
||||||
description: Use mocked data instead of live APIs
|
description: Use mocked data instead of live APIs
|
||||||
|
|||||||
Reference in New Issue
Block a user