From 70b5f9addcd6952fbbbeac3c99984c95da03d6a4 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 14 May 2014 17:07:31 -0400 Subject: [PATCH] some regex to scour the CSS and figure out the branding colors --- src/meta.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/meta.js b/src/meta.js index a73de67c8d..43d768fa37 100644 --- a/src/meta.js +++ b/src/meta.js @@ -364,9 +364,19 @@ var fs = require('fs'), process.exit(); } - Meta.css.cache = tree.toCSS({ + var css = tree.toCSS({ cleancss: true }); + + var re = /.brand-([\S]*?)[ ]*?{[\s\S]*?color:([\S\s]*?)}/gi, + match, + branding = {}; + + while (match = re.exec(css)) { + branding[match[1]] = match[2]; + } + + Meta.css.cache = css; winston.info('[meta/css] Done.'); }); });