From 474a852a54b27e12d67c326d275871d326c03b48 Mon Sep 17 00:00:00 2001 From: Tim Routowicz Date: Tue, 28 Apr 2015 09:52:14 -0400 Subject: [PATCH] Make auto-prefix util isomorphic --- src/styles/auto-prefix.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/styles/auto-prefix.js b/src/styles/auto-prefix.js index f264c18d7568ff..cbc1cb5c8cd57c 100644 --- a/src/styles/auto-prefix.js +++ b/src/styles/auto-prefix.js @@ -1,4 +1,5 @@ -var Modernizr = require('../utils/modernizr.custom'); +var isBrowser = typeof window !== 'undefined' ? true : false; +var Modernizr = isBrowser ? require('../utils/modernizr.custom') : undefined; module.exports = { @@ -15,15 +16,15 @@ module.exports = { }, single: function(key) { - return Modernizr.prefixed(key); + return isBrowser ? Modernizr.prefixed(key) : key; }, singleHyphened: function(key) { var str = this.single(key); - return str.replace(/([A-Z])/g, function(str,m1){ + return !str ? key : str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); } -} \ No newline at end of file +};