From 718e3f23b838871e6375a785748b785c3bcd5df7 Mon Sep 17 00:00:00 2001 From: francoismassart Date: Thu, 10 Jun 2021 19:51:07 +0200 Subject: [PATCH] fix: broken regex for extracting classnames --- lib/util/cssFiles.js | 2 +- tests/lib/rules/another.css | 39 ++++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/util/cssFiles.js b/lib/util/cssFiles.js index fcc7af69..30607b5e 100644 --- a/lib/util/cssFiles.js +++ b/lib/util/cssFiles.js @@ -28,7 +28,7 @@ const generateClassnamesListSync = (patterns) => { const data = fs.readFileSync(file, 'utf-8'); const root = postcss.parse(data); root.walkRules((rule) => { - const regexp = /\.([^\.\,\s\n]*)/gim; + const regexp = /\.([^\.\,\s\n\:\)]*)/gim; const matches = [...rule.selector.matchAll(regexp)]; const classnames = matches.map((arr) => arr[1]); detectedClassnames.push(...classnames); diff --git a/tests/lib/rules/another.css b/tests/lib/rules/another.css index e33bb8eb..403f7fe2 100644 --- a/tests/lib/rules/another.css +++ b/tests/lib/rules/another.css @@ -1,4 +1,37 @@ -/* Only used for running tests */ -.another { - display: block; +/* .custom-carousel li:first-child { + padding-left: 20vw; +} */ + +:global(.slide:not(.selected)) { + opacity: 0.2; +} + +.gallery-snackbar { + @apply w-full; +} + +.custom-slide { + height: 70vh; +} + +@media (min-width: 768px) { + .custom-carousel li:not(:first-child) { + @apply pl-16; + } + + .custom-carousel li:not(:last-child) { + @apply pr-16; + } + + .custom-carousel :global(.carousel-root) { + padding: 0 calc(10vw + 16px); + } + + .gallery-snackbar { + width: calc(80vw - 32px); + } + + .indicator { + margin-left: calc(10vw + 16px); + } }