@@ -8,10 +8,13 @@ var Token = require('../../tokenizer/token');
88var animationNameRegex = / ^ ( \- m o z \- | \- o \- | \- w e b k i t \- ) ? a n i m a t i o n - n a m e $ / ;
99var animationRegex = / ^ ( \- m o z \- | \- o \- | \- w e b k i t \- ) ? a n i m a t i o n $ / ;
1010var keyframeRegex = / ^ @ ( \- m o z \- | \- o \- | \- w e b k i t \- ) ? k e y f r a m e s / ;
11+ var importantRegex = / \s * ! i m p o r t a n t $ / ;
1112var optionalMatchingQuotesRegex = / ^ ( [ ' " ] ? ) ( .* ) \1$ / ;
1213
13- function removeQuotes ( value ) {
14- return value . replace ( optionalMatchingQuotesRegex , '$2' ) ;
14+ function normalize ( value ) {
15+ return value
16+ . replace ( optionalMatchingQuotesRegex , '$2' )
17+ . replace ( importantRegex , '' ) ;
1518}
1619
1720function removeUnusedAtRules ( tokens , context ) {
@@ -112,7 +115,7 @@ function matchFontFace(token, atRules) {
112115 property = token [ 2 ] [ i ] ;
113116
114117 if ( property [ 1 ] [ 1 ] == 'font-family' ) {
115- match = removeQuotes ( property [ 2 ] [ 1 ] . toLowerCase ( ) ) ;
118+ match = normalize ( property [ 2 ] [ 1 ] . toLowerCase ( ) ) ;
116119 atRules [ match ] = atRules [ match ] || [ ] ;
117120 atRules [ match ] . push ( token ) ;
118121 break ;
@@ -139,7 +142,7 @@ function markFontFacesAsUsed(atRules) {
139142 component = wrappedProperty . components [ 6 ] ;
140143
141144 for ( j = 0 , m = component . value . length ; j < m ; j ++ ) {
142- normalizedMatch = removeQuotes ( component . value [ j ] [ 1 ] . toLowerCase ( ) ) ;
145+ normalizedMatch = normalize ( component . value [ j ] [ 1 ] . toLowerCase ( ) ) ;
143146
144147 if ( normalizedMatch in atRules ) {
145148 delete atRules [ normalizedMatch ] ;
@@ -151,7 +154,7 @@ function markFontFacesAsUsed(atRules) {
151154
152155 if ( property [ 1 ] [ 1 ] == 'font-family' ) {
153156 for ( j = 2 , m = property . length ; j < m ; j ++ ) {
154- normalizedMatch = removeQuotes ( property [ j ] [ 1 ] . toLowerCase ( ) ) ;
157+ normalizedMatch = normalize ( property [ j ] [ 1 ] . toLowerCase ( ) ) ;
155158
156159 if ( normalizedMatch in atRules ) {
157160 delete atRules [ normalizedMatch ] ;
0 commit comments