Skip to content

Instantly share code, notes, and snippets.

// Singleton instance
let instance;
// Singleton class
const Singleton = class Singleton {
constructor(params){
// Instantiating instance as Singleton
if(!instance){
instance = this;
}
@iarry
iarry / svgo_sed.sh
Last active February 9, 2017 19:10
Optimizes SVG with SVGO, then strips it from all classes, ids, viewbox, removes the style tag, and replaces the svg tag with a g tag to be used within our Icon component. Also deletes the sed backup.
#!/bin/bash
original=$1
svgo $original
sed -i '.svg' 's/<style>[^<]*<\/style>//g; ;s/class="[^"]*" //g; s/ viewBox="[^"]*"//g; s/<svg/<g/g; s/<\/svg>/<\/g>/g; s/id="[^"]*" //g; s/ xmlns="[^"]*"//g' $original
rm $original.svg