Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for already-injected @font-face rules by src - Fixes #80 #82

Merged
merged 6 commits into from
Sep 16, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions dist/aphrodite.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ module.exports =

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }

var objectToPairs = function objectToPairs(obj) {
return Object.keys(obj).map(function (key) {
return [key, obj[key]];
Expand Down Expand Up @@ -221,6 +223,11 @@ module.exports =
};

exports.recursiveMerge = recursiveMerge;
var uniquify = function uniquify(values) {
return [].concat(_toConsumableArray(new Set(values)));
};

exports.uniquify = uniquify;
/**
* CSS properties which accept numbers but are not in units of "px".
* Taken from React's CSSProperty.js
Expand Down Expand Up @@ -441,9 +448,9 @@ module.exports =
// an array of objects and strings.
fontFamily: function fontFamily(val) {
if (Array.isArray(val)) {
return val.map(fontFamily).join(",");
return (0, _util.uniquify)(val.map(fontFamily)).join(",");
} else if (typeof val === "object") {
injectStyleOnce(val.fontFamily, "@font-face", [val], false);
injectStyleOnce(val.src, "@font-face", [val], false);
return '"' + val.fontFamily + '"';
} else {
return val;
Expand Down
Loading