Skip to content

Commit

Permalink
Make auto-prefix util isomorphic
Browse files Browse the repository at this point in the history
  • Loading branch information
troutowicz committed Apr 28, 2015
1 parent 9c068b7 commit 474a852
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/styles/auto-prefix.js
Original file line number Diff line number Diff line change
@@ -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 = {

Expand All @@ -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-');
}

}
};

0 comments on commit 474a852

Please sign in to comment.