Skip to content

Commit

Permalink
Merge pull request #591 from troutowicz/isomorphic_autoprefix
Browse files Browse the repository at this point in the history
Make auto-prefix util isomorphic
  • Loading branch information
Hai Nguyen committed Apr 28, 2015
2 parents 9c068b7 + 474a852 commit 77daca2
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 77daca2

Please sign in to comment.