Skip to content

Mediaquery and maven variable #92

Description

@yvanavermaet

Hi

We've encountered a small issue with our current set-up.

  • We use Akamai to cache our images
  • Some HTML-elements have a background-image
  • If we update these images (in our /img-folder), we also need to update a fingerprint (parameter 'c' in the examples below), so that these new images are picked up by Akamai (otherwise it'll return the old cached version)
  • The fingerprint is automatically replaced by Maven, our build tool

In the code below this works great

body {
    background: transparent url('../img/image-small.jpg?c=${buildNumber}') 50% top no-repeat;
    background-size: cover;
}

Output

body {
    background: transparent url("../img/image-small.jpg?c=${buildNumber}") 50% top no-repeat;
    background-size: cover;
}

If we now add a media query, this doesn't work

body {
    background: transparent url('../img/image-small.jpg?c=${buildNumber}') 50% top no-repeat;
    background-size: cover;

    @media only screen and (min-width: 600px) {
        background-image: url('../img/image-medium.jpg?c=${buildNumber}');
        background-position: left top;
    }
}

Output

body {
    background: transparent url("../img/image-small.jpg?c=${buildNumber}") 50% top no-repeat;
    background-size: cover;
}
    body {
        background-image: url("../img/image-medium.jpg?c=${buildNumber}");
        background-position: left top;
    }
}

Expected output

body {
    background: transparent url("../img/image-small.jpg?c=${buildNumber}") 50% top no-repeat;
    background-size: cover;
}

@media only screen and (min-width: 600px) {
    body {
        background-image: url("../img/image-medium.jpg?c=${buildNumber}");
        background-position: left top;
    }
}

Notice the missing media query
It's not possible to replace ${buildNumber} with another string/value.

Gulp-bless version 3.0.1, bless version 3.0.3.
At first I thought it was related to node-sass, but after further investigation, it seems it's related to (gulp-)bless

Thanks in advance.

Kind regards,
Yannick

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions