Skip to content

at-media + at-keyframes not minified correctly #23

Open
@firewizard

Description

@firewizard

Minifier break css when at-media & at-keyframes are used together.

This css:

@media (min-width: 0) and (max-width: 360px) {
    @keyframes loop {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-100% + 360px));
        }
    }
}

@media (min-width: 480px) {
    @keyframes loop {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-100% + 480px));
        }
    }
}

.a {
    color: red
}

when minified and then re-formatted, produces this result:

@media (min-width: 0) and (max-width: 360px) {
    @keyframes loop {
        0% {
            transform: translateX(0)
        }
        100% {
            transform: translateX(calc(-100% + 360px))
        }
    }@media (min-width: 480px) {
    @keyframes loop {
        0% {
            transform: translateX(0)
        }
        100% {
            transform: translateX(calc(-100% + 480px))
        }
    }
} .a {
      color: red
  }

Notice the missing "}". If there's only one at-media + at-keyframes block, it works well, if there are more, it breaks all of them except the last one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions