This repository was archived by the owner on Apr 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,27 @@ function buildApplyCache(applyCandidates, context) {
2727 return context . applyClassCache
2828}
2929
30+ // TODO: Apply `!important` stuff correctly instead of just skipping it
31+ function extractApplyCandidates ( params ) {
32+ let candidates = params . split ( / [ \s \t \n ] + / g)
33+
34+ if ( candidates [ candidates . length - 1 ] === '!important' ) {
35+ candidates = candidates . slice ( 0 , - 1 )
36+ }
37+
38+ return candidates
39+ }
40+
3041function expandApplyAtRules ( context ) {
3142 return ( root ) => {
3243 let applyCandidates = new Set ( )
3344
3445 // Collect all @apply rules and candidates
3546 let applies = [ ]
3647 root . walkAtRules ( 'apply' , ( rule ) => {
37- for ( let util of rule . params . split ( / [ \s \t \n ] + / g) ) {
48+ let candidates = extractApplyCandidates ( rule . params )
49+
50+ for ( let util of candidates ) {
3851 applyCandidates . add ( util )
3952 }
4053 applies . push ( rule )
@@ -75,7 +88,8 @@ function expandApplyAtRules(context) {
7588
7689 for ( let apply of applies ) {
7790 let siblings = [ ]
78- let applyCandidates = apply . params . split ( / [ \s \t \n ] + / g)
91+ let applyCandidates = extractApplyCandidates ( apply . params )
92+
7993 for ( let applyCandidate of applyCandidates ) {
8094 if ( ! applyClassCache . has ( applyCandidate ) ) {
8195 throw new Error (
You can’t perform that action at this time.
0 commit comments