borodean / postcss-assets

An asset manager for PostCSS
MIT License
537 stars 32 forks source link

Size functions in @media #53

Closed Ser-Gen closed 8 years ago

Ser-Gen commented 8 years ago

I need to use height(image) in media features, but I can't.

.Page--blank {
    @media screen and (min-height: height(image)) {
        background-size: cover;
    }
}
@media screen and (min-height: height(image)) {
    .Page--blank {
        background-size: cover;
    }
}

I have workaround this with variable, but it not obvious:

$imageHeight: height(image);

.Page--blank {
    @media screen and (min-height: $imageHeight) {
        background-size: cover;
    }
}
@media screen and (min-height: 1200px) {
    .Page--blank {
        background-size: cover;
    }
}
borodean commented 8 years ago

I've added a test case (https://github.com/assetsjs/postcss-assets/commit/e53cb896a7e37035592edea64370fc935215c913) checking media queries support and it is happily succeeding.

Could you give more info about your environment so we can see why this happens to you? The node version, installed packages versions (be sure to check if installed packages are up-to-date with package.json), how the PostCSS is being called.

Ser-Gen commented 8 years ago

Oops, excuse me for troubling! I'm using old 2.1.3. Current version work as expected. Will double check this next time!