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

Multiple backgrounds #82

Closed
celorodovalho opened this issue Sep 4, 2014 · 1 comment
Closed

Multiple backgrounds #82

celorodovalho opened this issue Sep 4, 2014 · 1 comment

Comments

@celorodovalho
Copy link

Hi,
I have the following section/rule:

.gradient {
    background: linear-gradient(45deg,transparent 0%,transparent 74%,#cce7f5 74%,#cce7f5 80%,transparent 80%,transparent 82%,#cce7f5 82%,#cce7f5 85%,transparent 85%,transparent 89%,#cce7f5 89%,#cce7f5 91%,transparent 91%,transparent 100%) no-repeat border-box,linear-gradient(to bottom,#53bce2 0%,#53bce2 80%,#54abbe 100%) no-repeat border-box;
}

And I need to get the value of the rule "background", but I need get separately, for exemple:

array(
    'background-image' => array(
        'linear-gradient(45deg,transparent 0%,transparent 74%,#cce7f5 74%,#cce7f5 80%,transparent 80%,transparent 82%,#cce7f5 82%,#cce7f5 85%,transparent 85%,transparent 89%,#cce7f5 89%,#cce7f5 91%,transparent 91%,transparent 100%)',
        'linear-gradient(to bottom,#53bce2 0%,#53bce2 80%,#54abbe 100%')
    ),
    'background-repeat' => array('no-repeat','no-repeat'),
    'background-origin' => array('border-box','border-box'),
);

...or something like this, but I just need the get the values of "background" separately (background-image, background-repeat, background-origin).
How can I do this?

@sabberworm
Copy link
Contributor

That’s not currently possible, I’m afraid. The CSS Parser has no knowledge of the semantic meaning of individual CSS property names and values. There is the work that @ju1ius has done with expanding and collapsing shorthands but I don’t think it supports multiple backgrounds as it predates support for these.

If you do find the time to adapt DeclarationBlock#expandBackgroundShorthand and DeclarationBlock#createBackgroundShorthand for CSS3 backgrounds, I’d love a patch.

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

No branches or pull requests

2 participants