How to use the svgo/plugins/convertTransform.params function in svgo

To help you get started, we’ve selected a few svgo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexjlockwood / ShapeShifter / src / app / modules / editor / scripts / svgo / index.ts View on Github external
};

// Set a global floatPrecision across all the plugins.
const floatPrecision = 6;
for (const plugin of Object.values(pluginsData)) {
  if (plugin.params && 'floatPrecision' in plugin.params) {
    plugin.params.floatPrecision = floatPrecision;
  }
}

// Tweak plugin params.
cleanupIDs.params.minify = false;
convertPathData.params.makeArcs = undefined;
convertPathData.params.transformPrecision = floatPrecision;
convertShapeToPath.params.convertArcs = true;
convertTransform.params.transformPrecision = floatPrecision;
inlineStyles.params.onlyMatchedOnce = false;
removeUselessStrokeAndFill.params.removeNone = true;

const optimizedPluginsData = (function () {
  return Object.values(pluginsData)
    .map(item => [item])
    .reduce((arr, item) => {
      const last = arr[arr.length - 1];
      if (last && item[0].type === last[0].type) {
        last.push(item[0]);
      } else {
        arr.push(item);
      }
      return arr;
    }, []);
})();
github alexjlockwood / svg2vd / src / lib / svgo.ts View on Github external
};

// Set a global floatPrecision across all the plugins.
const floatPrecision = 6;
for (const plugin of Object.values(pluginsData)) {
  if (plugin.params && 'floatPrecision' in plugin.params) {
    plugin.params.floatPrecision = floatPrecision;
  }
}

// Tweak plugin params.
cleanupIDs.params.minify = false;
convertPathData.params.makeArcs = undefined;
convertPathData.params.transformPrecision = floatPrecision;
convertShapeToPath.params.convertArcs = true;
convertTransform.params.transformPrecision = floatPrecision;
inlineStyles.params.onlyMatchedOnce = false;
removeUselessStrokeAndFill.params.removeNone = true;

const optimizedPluginsData = (function() {
  return Object.values(pluginsData)
    .map(item => [item])
    .reduce((arr, item) => {
      const last = arr[arr.length - 1];
      if (last && item[0].type === last[0].type) {
        last.push(item[0]);
      } else {
        arr.push(item);
      }
      return arr;
    }, []);
})();