Skip to content
Permalink
Browse files

chore: font mapper

  • Loading branch information...
dariocravero committed Apr 3, 2019
1 parent ed8dbda commit 04730cab8336e1e628c600ece5b994eabd7d4e99
Showing with 28 additions and 0 deletions.
  1. +28 −0 map-fonts.js
@@ -0,0 +1,28 @@
let weights = {
Thin: 100,
Light: 200,
Regular: 300,
Medium: 400,
Semibold: 500,
Bold: 600,
Extrabold: 700,
Black: 800,
}
let weightsKeys = Object.keys(weights)

let fs = require('fs')
let path = require('path')

let fonts = fs.readdirSync(process.argv[2])
fonts.forEach(oldFile => {
let file = path.basename(oldFile)

let weight = weightsKeys.find(weight => file.includes(weight))

file = file.replace(weight, weights[weight]).replace('Italic', '-italic')

fs.copyFileSync(
path.join(process.argv[2], oldFile),
path.join(process.argv[3], file)
)
})

0 comments on commit 04730ca

Please sign in to comment.
You can’t perform that action at this time.