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: simplify interpolation handling #418

Merged
merged 5 commits into from
Dec 20, 2020
Merged

Conversation

itsdouges
Copy link
Collaborator

@itsdouges itsdouges commented Dec 19, 2020

This PR simplifies the interpolation handling by making more assumptions, and handling only things that would actually happen. Obviously invalid suffix/prefixes and the like are now unsupported.

Closes #413
Closes #345

@@ -15,43 +11,25 @@ export interface BeforeInterpolation {
}

/**
* Will return any suffix out of the CSS and return them both.
* Will remove any suffix out of the CSS and return them both.
*
* E.g. `'px;font-size: 20px;'` would return `"px"` as the suffix and `";font-size: 20px;"` as the CSS.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add examples for more cases? Like when regex matched and when not. Might be helpful in future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea

@@ -62,39 +40,17 @@ export const cssAfterInterpolation = (css: string): AfterInterpolation => {
* @param css all the CSS before the interpolation
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some examples here too? hehe

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

@pgmanutd
Copy link
Contributor

Looks good. Love that we have cleaned messy code hehe. If possible just add few examples in jsdoc which will be helpful for future developers.

@itsdouges
Copy link
Collaborator Author

all done

Copy link
Contributor

@pgmanutd pgmanutd left a comment

Choose a reason for hiding this comment

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

lgtm

@itsdouges itsdouges merged commit 49bbcb9 into master Dec 20, 2020
@itsdouges itsdouges deleted the simplify-interpolations branch December 20, 2020 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants