diff --git a/src/lib/generateRules.js b/src/lib/generateRules.js index f64f90c..88db81a 100644 --- a/src/lib/generateRules.js +++ b/src/lib/generateRules.js @@ -140,9 +140,11 @@ function* resolveMatchedPlugins(classCandidate, context) { let candidatePrefix = classCandidate let negative = false - if (candidatePrefix[0] === '-') { + const twConfigPrefix = context.tailwindConfig.prefix || '' + const twConfigPrefixLen = twConfigPrefix.length + if (candidatePrefix[twConfigPrefixLen] === '-') { negative = true - candidatePrefix = candidatePrefix.slice(1) + candidatePrefix = twConfigPrefix + candidatePrefix.slice(twConfigPrefixLen + 1) } for (let [prefix, modifier] of candidatePermutations(candidatePrefix)) { diff --git a/tests/05-prefix.test.css b/tests/05-prefix.test.css index 92b774c..edb2c47 100644 --- a/tests/05-prefix.test.css +++ b/tests/05-prefix.test.css @@ -47,6 +47,9 @@ .tw-dark .tw-group:hover .custom-component { font-weight: 400; } +.tw--ml-4 { + margin-left: -1rem; +} .tw-font-bold { font-weight: 700; } @@ -71,6 +74,12 @@ text-align: left; } @media (min-width: 768px) { + .md\:tw--ml-5 { + margin-left: -1.25rem; + } + .md\:hover\:tw--ml-6:hover { + margin-left: -1.5rem; + } .md\:hover\:tw-text-right:hover { text-align: right; } diff --git a/tests/05-prefix.test.html b/tests/05-prefix.test.html index c78c05f..51ed71d 100644 --- a/tests/05-prefix.test.html +++ b/tests/05-prefix.test.html @@ -1,3 +1,6 @@ +
+ +