From 117578ddc6562fa8a4e451c68260c680489c6909 Mon Sep 17 00:00:00 2001 From: Kevin Kirchner Date: Wed, 25 Jan 2017 11:03:40 -0500 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20prevent=20when=20using=20valid?= =?UTF-8?q?=20font-weight=20values.=20Fixes=20#24?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/compile.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/compile.js b/lib/compile.js index 9b53208..29e7c10 100644 --- a/lib/compile.js +++ b/lib/compile.js @@ -76,8 +76,21 @@ var compile = { } else if (/fontWeight/.test(property)) { if (/^(normal|bold|[1-9]00)$/.test(value)) { obj[property] = '"' + value + '"'; - } else if (/^['|"](normal|bold|[1-9]00)['|"]$/.test(value)) { - obj[property] = value; + } else if (/^['|"]?(normal|bold|[1-9]00)['|"]?$/.test(value)) { + obj[property] = value + ''; + } else if (/^['|"]?(bolder|lighter|initial|inherit|unset)['|"]?$/.test(value)) { + switch (value) { + case 'bolder': + obj[property] = '900'; + atom.notifications.addInfo('`bolder` value set to `900`') + break; + case 'lighter': + obj[property] = '200'; + atom.notifications.addInfo('`lighter` value set to `200`') + break; + default: + atom.notifications.addWarning('`' + value + '` value was not set') + } } else { throw new Error('fontWeight value in ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"]'); }