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

Fix multiple @font-face of the same name #327

Merged
merged 2 commits into from
Jun 8, 2018
Merged

Fix multiple @font-face of the same name #327

merged 2 commits into from
Jun 8, 2018

Conversation

milesj
Copy link
Contributor

@milesj milesj commented May 23, 2018

Fix for #296. Verified the fix locally in one of my projects by editing the node_modules file.

Sidenote, I'd highly suggest using Jest snapshots to verify buffered output instead of assertStylesInclude, which is extremely flakey.

@kesne
Copy link

kesne commented May 23, 2018

@lencioni

src/inject.js Outdated
@@ -2,8 +2,8 @@
import asap from 'asap';

import OrderedElements from './ordered-elements';
import {generateCSS} from './generate';
import {hashObject, hashString} from './util';
import { generateCSS } from './generate';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My editor auto formats this. I can change back if need be.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer it the way you have formatted it here, but Khan's style guide is the way it was. I don't think it matters too much, but these stylistic changes should probably be avoided to reduce diff churn. If we want to change the code style of this project, that should all be done at one time. Can you change this (and any other changes like this e.g. line 51) back?

@@ -66,7 +66,13 @@ const stringHandlers = {
// an array of objects and strings.
fontFamily: function fontFamily(val) {
if (Array.isArray(val)) {
return val.map(fontFamily).join(",");
const nameMap = {};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was gonna use Set, but I didn't see that or Map used anywhere else. Playing it safe.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, we've avoided these things so it would be nice to keep it that way unless there is a compelling reason not to.

I think the order of the keys in the object are not guaranteed on older versions of Node, but that might not matter anymore so this should be okay.

Copy link
Collaborator

@lencioni lencioni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this! I agree that Jest snapshots would be perfect for this and am in favor of switching to that. If you have time would you be willing to put up a PR that gets aphrodite onto Jest?

src/inject.js Outdated
@@ -2,8 +2,8 @@
import asap from 'asap';

import OrderedElements from './ordered-elements';
import {generateCSS} from './generate';
import {hashObject, hashString} from './util';
import { generateCSS } from './generate';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer it the way you have formatted it here, but Khan's style guide is the way it was. I don't think it matters too much, but these stylistic changes should probably be avoided to reduce diff churn. If we want to change the code style of this project, that should all be done at one time. Can you change this (and any other changes like this e.g. line 51) back?

@@ -66,7 +66,13 @@ const stringHandlers = {
// an array of objects and strings.
fontFamily: function fontFamily(val) {
if (Array.isArray(val)) {
return val.map(fontFamily).join(",");
const nameMap = {};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, we've avoided these things so it would be nice to keep it that way unless there is a compelling reason not to.

I think the order of the keys in the object are not guaranteed on older versions of Node, but that might not matter anymore so this should be okay.

@milesj
Copy link
Contributor Author

milesj commented Jun 7, 2018

@lencioni Fixed formatting/spacing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants