-
Notifications
You must be signed in to change notification settings - Fork 7
Feature/fix responsive overrides #17 #18
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
Feature/fix responsive overrides #17 #18
Conversation
@tdhooper Sorry for my delay here. Will review this today or tomorrow. Thanks for your help again! |
lib/index.js
Outdated
// * The background definition has at-2x applied | ||
function extractRetinaImage(identifier, background) { | ||
const match = background.match(imageRegex); | ||
const [image, type, value] = match; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check if match could be null
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot!
Great stuff. Cheers |
opened += open - close; | ||
}); | ||
return backgrounds; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tdhooper Curious about the intention of this function. Could the same not be achieved with return value.split(',')
?
That was my initial approach, but it returns separate parts for the linear-gradient syntax.
Then again, the rest of the code should cope fine with that now.
… On 5 Jul 2017, at 10:04 pm, Simon Smith ***@***.***> wrote:
@simonsmith commented on this pull request.
In lib/index.js:
> +
+function splitMultipleBackgrounds(value) {
+ const backgrounds = [];
+ let opened = 0;
+ value.split(',').forEach((part) => {
+ if (opened > 0) {
+ backgrounds[backgrounds.length - 1] += `,${part}`;
+ } else {
+ backgrounds.push(part);
+ }
+ const open = count(part, '(');
+ const close = count(part, ')');
+ opened += open - close;
+ });
+ return backgrounds;
+}
@tdhooper Curious about the intention of this function. Could the same not be achieved with return value.split(',')?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Looking at this a bit more, for the given css: .multi {
background: url(http://example.com/image.png),
linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1)),
green,
url(/public/images/cool.png) at-2x;
} I don't think we should repeat Instead, .multi {
background-image: url(http://example.com/image.png),
linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1)),
none,
url(/public/images/cool@2x.png);
} |
Fixes #17