clean-css icon indicating copy to clipboard operation
clean-css copied to clipboard

"Invalid property name 'from," when minifying keyframe animations

Open cyrilmestrom opened this issue 9 years ago • 9 comments

When minifying my css animations file every animation fails. Am I missing something:

Unexpected '}' at wwwroot/style/css/animations.css:10:0.,Unexpected '}' at wwwroot/style/css/animations.css:18:0.,Unexpected '}' at wwwroot/style/css/animations.css:26:0.,Unexpected '}' at wwwroot/style/css/animations.css:36:0.,Unexpected '}' at wwwroot/style/css/animations.css:46:0.,Unexpected '}' at wwwroot/style/css/animations.css:56:0.,Unexpected '}' at wwwroot/style/css/animations.css:64:0.,Unexpected '}' at wwwroot/style/css/animations.css:72:0.,Unexpected '}' at wwwroot/style/css/animations.css:80:0.,Unexpected '}' at wwwroot/style/css/animations.css:88:0.,Unexpected '}' at wwwroot/style/css/animations.css:96:0.,Unexpected '}' at wwwroot/style/css/animations.css:104:0.,Unexpected '}' at wwwroot/style/css/animations.css:112:0.,Unexpected '}' at wwwroot/style/css/animations.css:120:0.,Unexpected '}' at wwwroot/style/css/animations.css:128:0.,Unexpected '}' at wwwroot/style/css/animations.css:141:0.,Unexpected '}' at wwwroot/style/css/animations.css:154:0.,Invalid character(s) '}' at wwwroot/style/css/animations.css:154:0. Ignoring.,Invalid property name 'from { .[....]

My animations looks like this:

@keyframes moveup { from { -moz-transform: translateY(50px); -ms-transform: translateY(50px); -o-transform: translateY(50px); -webkit-transform: translateY(50px); transform: translateY(50px); opacity: 0; } to { -moz-transform: translateY(0); -ms-transform: translateY(0); -o-transform: translateY(0); -webkit-transform: translateY(0); transform: translateY(0); opacity: 1; } }

I'm pretty sure my css is correct...

cyrilmestrom avatar Feb 26 '17 14:02 cyrilmestrom

@cyrilmestrom which version of clean-css do you use?

jakubpawlowicz avatar Mar 01 '17 10:03 jakubpawlowicz

Hi, it's 4.0.8 with cssmin 2.0.0. Thanks

cyrilmestrom avatar Mar 06 '17 09:03 cyrilmestrom

By the way, same error arises when trying to minify a print stylesheet:

Unexpected '}' at wwwroot/style/css/overview-print.css:90:0.,Invalid character(s) '}

cyrilmestrom avatar Mar 06 '17 14:03 cyrilmestrom

This is what I get on 4.0.8:

@keyframes moveup{from{-moz-transform:translateY(50px);-ms-transform:translateY(50px);-o-transform:translateY(50px);-webkit-transform:translateY(50px);transform:translateY(50px);opacity:0}to{-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);-webkit-transform:translateY(0);transform:translateY(0);opacity:1}}

without any warnings or errors.

Could you please share a bigger piece of animations.css either publicly or privately?

jakubpawlowicz avatar Mar 08 '17 09:03 jakubpawlowicz

Perhaps it has something to do with grunt being used in Visual Studio 2015? Thanks for checking.

Full file:

@keyframes moveup { from { -moz-transform: translateY(50px); -ms-transform: translateY(50px); -o-transform: translateY(50px); -webkit-transform: translateY(50px); transform: translateY(50px); opacity: 0 }

to {
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    -webkit-transform: translateY(0);
    transform: translateY(0);
    opacity: 1
}

}

@keyframes scaleup { from { -moz-transform: scale(.7); -ms-transform: scale(.7); -o-transform: scale(.7); -webkit-transform: scale(.7); transform: scale(.7) }

to {
    -moz-transform: scale(1);
    -ms-transform: scale(1);
    -o-transform: scale(1);
    -webkit-transform: scale(1);
    transform: scale(1)
}

}

@keyframes scaleDown { from { -moz-transform: scale(1.5); -ms-transform: scale(1.5); -o-transform: scale(1.5); -webkit-transform: scale(1.5); transform: scale(1.5) }

to {
    -moz-transform: scale(1);
    -ms-transform: scale(1);
    -o-transform: scale(1);
    -webkit-transform: scale(1);
    transform: scale(1)
}

}

@keyframes scaleFromOutAndFade { from { -moz-transform: scale(1.5); -ms-transform: scale(1.5); -o-transform: scale(1.5); -webkit-transform: scale(1.5); transform: scale(1.5); opacity: 0 }

to {
    -moz-transform: scale(1);
    -ms-transform: scale(1);
    -o-transform: scale(1);
    -webkit-transform: scale(1);
    transform: scale(1);
    opacity: 1
}

}

@keyframes scaleDownAndFade { from { -moz-transform: scale(1); -ms-transform: scale(1); -o-transform: scale(1); -webkit-transform: scale(1); transform: scale(1); opacity: 1 }

to {
    -moz-transform: scale(.3);
    -ms-transform: scale(.3);
    -o-transform: scale(.3);
    -webkit-transform: scale(.3);
    transform: scale(.3);
    opacity: 0
}

}

@keyframes scaleUpAndFade { from { -moz-transform: scale(1); -ms-transform: scale(1); -o-transform: scale(1); -webkit-transform: scale(1); transform: scale(1); opacity: 1 }

to {
    -moz-transform: scale(2);
    -ms-transform: scale(2);
    -o-transform: scale(2);
    -webkit-transform: scale(2);
    transform: scale(2);
    opacity: 0
}

}

@keyframes fadeIn { from { opacity: 0 }

to {
    opacity: 1
}

}

@keyframes slideInUp { from { -moz-transform: translateY(100%); -ms-transform: translateY(100%); -o-transform: translateY(100%); -webkit-transform: translateY(100%); transform: translateY(100%) }

to {
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    -webkit-transform: translateY(0);
    transform: translateY(0)
}

}

@keyframes slideOutUp { from { -moz-transform: translateY(0); -ms-transform: translateY(0); -o-transform: translateY(0); -webkit-transform: translateY(0); transform: translateY(0) }

to {
    -moz-transform: translateY(-100%);
    -ms-transform: translateY(-100%);
    -o-transform: translateY(-100%);
    -webkit-transform: translateY(-100%);
    transform: translateY(-100%)
}

}

@keyframes slideInDown { from { -moz-transform: translateY(-100%); -ms-transform: translateY(-100%); -o-transform: translateY(-100%); -webkit-transform: translateY(-100%); transform: translateY(-100%) }

to {
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    -webkit-transform: translateY(0);
    transform: translateY(0)
}

}

@keyframes slideOutDown { from { -moz-transform: translateY(0); -ms-transform: translateY(0); -o-transform: translateY(0); -webkit-transform: translateY(0); transform: translateY(0) }

to {
    -moz-transform: translateY(100%);
    -ms-transform: translateY(100%);
    -o-transform: translateY(100%);
    -webkit-transform: translateY(100%);
    transform: translateY(100%)
}

}

@keyframes slideInLeft { from { -moz-transform: translateX(-100%); -ms-transform: translateX(-100%); -o-transform: translateX(-100%); -webkit-transform: translateX(-100%); transform: translateX(-100%) }

to {
    -moz-transform: translateX(0);
    -ms-transform: translateX(0);
    -o-transform: translateX(0);
    -webkit-transform: translateX(0);
    transform: translateX(0)
}

}

@keyframes slideOutLeft { from { -moz-transform: translateX(0); -ms-transform: translateX(0); -o-transform: translateX(0); -webkit-transform: translateX(0); transform: translateX(0) }

to {
    -moz-transform: translateX(-100%);
    -ms-transform: translateX(-100%);
    -o-transform: translateX(-100%);
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%)
}

}

@keyframes slideInRight { from { -moz-transform: translateX(100%); -ms-transform: translateX(100%); -o-transform: translateX(100%); -webkit-transform: translateX(100%); transform: translateX(100%) }

to {
    -moz-transform: translateX(0);
    -ms-transform: translateX(0);
    -o-transform: translateX(0);
    -webkit-transform: translateX(0);
    transform: translateX(0)
}

}

@keyframes slideOutRight { from { -moz-transform: translateX(0); -ms-transform: translateX(0); -o-transform: translateX(0); -webkit-transform: translateX(0); transform: translateX(0) }

to {
    -moz-transform: translateX(100%);
    -ms-transform: translateX(100%);
    -o-transform: translateX(100%);
    -webkit-transform: translateX(100%);
    transform: translateX(100%)
}

}

@-webkit-keyframes scale-before { 0% { -webkit-transform: scale(0); transform: scale(0); opacity: 1 }

40% {
    opacity: .5
}

100% {
    -webkit-transform: scale(2);
    transform: scale(2);
    opacity: 0
}

}

@keyframes scale-before { 0% { -webkit-transform: scale(0); transform: scale(0); opacity: 1 }

40% {
    opacity: .5
}

100% {
    -webkit-transform: scale(2);
    transform: scale(2);
    opacity: 0
}

}

@-webkit-keyframes scale-after { 0% { -webkit-transform: scale(0); transform: scale(0); opacity: 1 }

40% {
    opacity: .5
}

100% {
    -webkit-transform: scale(3);
    transform: scale(3);
    opacity: 0
}

}

@keyframes scale-after { 0% { -webkit-transform: scale(0); transform: scale(0); opacity: 1 }

40% {
    opacity: .5
}

100% {
    -webkit-transform: scale(3);
    transform: scale(3);
    opacity: 0
}

}

cyrilmestrom avatar Mar 09 '17 10:03 cyrilmestrom

Sorry for late update but it somehow went under my radar - I still find the full file working just fine - you can try dropping it into https://jakubpawlowicz.github.io/clean-css/ where 4.0.12 is used. animations.css.txt

jakubpawlowicz avatar Apr 20 '17 06:04 jakubpawlowicz

^ used txt extension as GitHub doesn't like css

jakubpawlowicz avatar Apr 20 '17 06:04 jakubpawlowicz

@cyrilmestrom I'll close it tomorrow unless there is a way to reproduce it.

jakubpawlowicz avatar May 07 '17 06:05 jakubpawlowicz

Please comment further if needed!

jakubpawlowicz avatar May 09 '17 05:05 jakubpawlowicz