Youen Toupin
3 years ago
6 changed files with 599 additions and 92 deletions
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 130 KiB |
@ -1,4 +1,6 @@
|
||||
#!/bin/bash |
||||
|
||||
cd src |
||||
node embed.js |
||||
../node_modules/typescript/bin/tsc |
||||
node purify.js |
||||
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 128 KiB |
@ -0,0 +1,22 @@
|
||||
let fs = require('fs') |
||||
|
||||
function embedSvg(src, dst) { |
||||
fs.readFile(src, 'utf8', function(err, data) { |
||||
if(err) throw err; |
||||
data = data.replace(/<\?xml[^\?]*\?>[\r\n]*/g, ''); |
||||
data = data.replace(/<svg[^>]*>[\r\n]*/g, ''); |
||||
data = data.replace(/<\/svg>[\r\n]*/g, ''); |
||||
|
||||
data = data.replace(/>\s*<desc[^>]*>/g, ' '); |
||||
data = data.replace(/<\/desc>/g, '>'); |
||||
data = data.replace(/"/g, '"'); |
||||
|
||||
data = "(<any>window)['"+src+"'] = `" + data + "`;"; |
||||
|
||||
fs.writeFile(dst, data, function(err) { |
||||
if(err) throw err; |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
embedSvg('climate-zones-map.svg', 'climate-zones-map.svg.ts'); |
Loading…
Reference in new issue