From 307b753c2d59850cab12c14a063c5a7f02198c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 18:30:27 +0300 Subject: [PATCH 01/10] add uppercase support --- __tests__/issues.test.js | 39 +++++++++++++++++++++++++++++++++++++++ src/utils.js | 4 ++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/__tests__/issues.test.js b/__tests__/issues.test.js index a294e93..1c7daf1 100644 --- a/__tests__/issues.test.js +++ b/__tests__/issues.test.js @@ -114,3 +114,42 @@ test('issue 25', async () => { " `) }) + +test('issue 37', async () => { + expect( + await utils.diffOnly({ + content: [utils.content()], + darkMode: 'class', + theme: { + variables: { + DEFAULT: { + ONE: 'red', + TWO: { + DEFAULT: 'black', + FOObar: 'green', + THREE: { + FOUR: 'white', + five: 'blue', + }, + }, + }, + }, + }, + + plugins: [tailwindcssVariables()], + }) + ).toMatchInlineSnapshot(` + " + + + + :root { + + --ONE: red; + + --TWO: black; + + --TWO-FOObar: green; + + --TWO-THREE-FOUR: white; + + --TWO-THREE-five: blue + + } + + " + `) +}) diff --git a/src/utils.js b/src/utils.js index 0e02faa..9c2ca48 100644 --- a/src/utils.js +++ b/src/utils.js @@ -42,10 +42,10 @@ const formatVariableKey = (key) => { if (key === 'DEFAULT') { return '' } - key = key.toLowerCase() + key = key.toString() return key .replace(/_/g, '-') - .replace(/[^a-z0-9\-]+/gi, '') + .replace(/[^a-zA-Z0-9\-]+/gi, '') .replace('---', '--') } From d0355cdad5fa6690cb739f145fcdc55404c49206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 18:32:01 +0300 Subject: [PATCH 02/10] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec47a4b..e8aa612 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mertasan/tailwindcss-variables", - "version": "2.3.0", + "version": "2.3.1", "description": "Easily create css variables without the need for a css file!", "main": "src/index.js", "license": "GPL-3.0-or-later", From fff2b38977fb06b05cb6efe779f0534b24804dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 18:51:28 +0300 Subject: [PATCH 03/10] Bump tailwindcss from 3.0.0 to 3.0.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e8aa612..d3f41ef 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "postcss-import": "^14.1.0", "prettier": "^2.5.0", "snapshot-diff": "^0.9.0", - "tailwindcss": "^3.0.0" + "tailwindcss": "^3.0.11" }, "peerDependencies": { "autoprefixer": "^10.0.2", From bfcade3a90a0fb4f11b383138a72c6508d303608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 18:52:24 +0300 Subject: [PATCH 04/10] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d3f41ef..c82898b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mertasan/tailwindcss-variables", - "version": "2.3.1", + "version": "2.4.0", "description": "Easily create css variables without the need for a css file!", "main": "src/index.js", "license": "GPL-3.0-or-later", From 83579975e744b19ea6105c192c9c9b57057854aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 18:58:30 +0300 Subject: [PATCH 05/10] wip --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b1b77ab..f4c66ed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ jobs: uses: actions/cache@v2 with: path: node_modules - key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }}-tests + key: nodeModules-${{ hashFiles('./package-lock.json') }}-${{ matrix.node-version }}-tests restore-keys: | nodeModules- From e0ea83a1cc8f00990657f9dab3ce9f9127f6f90b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 18:58:34 +0300 Subject: [PATCH 06/10] update versions --- examples/color-variable-helper/package.json | 2 +- examples/dark-custom-selector/package.json | 2 +- examples/dark-with-class-to-root/package.json | 2 +- examples/dark-with-class/package.json | 2 +- examples/dark-with-media/package.json | 2 +- examples/prefix/package.json | 2 +- examples/simple/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/color-variable-helper/package.json b/examples/color-variable-helper/package.json index 1db9dd0..3144e43 100644 --- a/examples/color-variable-helper/package.json +++ b/examples/color-variable-helper/package.json @@ -9,7 +9,7 @@ "@mertasan/tailwindcss-variables": "latest", "autoprefixer": "^10.4.0", "postcss": "^8.4.4", - "tailwindcss": "^3.0.0" + "tailwindcss": "^3.0.11" }, "license": "MIT" } diff --git a/examples/dark-custom-selector/package.json b/examples/dark-custom-selector/package.json index fc8cd68..24c0349 100644 --- a/examples/dark-custom-selector/package.json +++ b/examples/dark-custom-selector/package.json @@ -9,7 +9,7 @@ "@mertasan/tailwindcss-variables": "latest", "autoprefixer": "^10.4.0", "postcss": "^8.4.4", - "tailwindcss": "^3.0.0" + "tailwindcss": "^3.0.11" }, "license": "MIT" } diff --git a/examples/dark-with-class-to-root/package.json b/examples/dark-with-class-to-root/package.json index 086edd8..ccf1627 100644 --- a/examples/dark-with-class-to-root/package.json +++ b/examples/dark-with-class-to-root/package.json @@ -9,7 +9,7 @@ "@mertasan/tailwindcss-variables": "latest", "autoprefixer": "^10.4.0", "postcss": "^8.4.4", - "tailwindcss": "^3.0.0" + "tailwindcss": "^3.0.11" }, "license": "MIT" } diff --git a/examples/dark-with-class/package.json b/examples/dark-with-class/package.json index 111275d..bf71212 100644 --- a/examples/dark-with-class/package.json +++ b/examples/dark-with-class/package.json @@ -9,7 +9,7 @@ "@mertasan/tailwindcss-variables": "latest", "autoprefixer": "^10.4.0", "postcss": "^8.4.4", - "tailwindcss": "^3.0.0" + "tailwindcss": "^3.0.11" }, "license": "MIT" } diff --git a/examples/dark-with-media/package.json b/examples/dark-with-media/package.json index dfa254d..b8c8e51 100644 --- a/examples/dark-with-media/package.json +++ b/examples/dark-with-media/package.json @@ -9,7 +9,7 @@ "@mertasan/tailwindcss-variables": "latest", "autoprefixer": "^10.4.0", "postcss": "^8.4.4", - "tailwindcss": "^3.0.0" + "tailwindcss": "^3.0.11" }, "license": "MIT" } diff --git a/examples/prefix/package.json b/examples/prefix/package.json index da9285e..118972a 100644 --- a/examples/prefix/package.json +++ b/examples/prefix/package.json @@ -9,7 +9,7 @@ "@mertasan/tailwindcss-variables": "latest", "autoprefixer": "^10.4.0", "postcss": "^8.4.4", - "tailwindcss": "^3.0.0" + "tailwindcss": "^3.0.11" }, "license": "MIT" } diff --git a/examples/simple/package.json b/examples/simple/package.json index f1de172..b7700d2 100644 --- a/examples/simple/package.json +++ b/examples/simple/package.json @@ -9,7 +9,7 @@ "@mertasan/tailwindcss-variables": "latest", "autoprefixer": "^10.4.0", "postcss": "^8.4.4", - "tailwindcss": "^3.0.0" + "tailwindcss": "^3.0.11" }, "license": "MIT" } From b6648db06c2c8ee58b3f5a4ce1670d994af63712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 19:02:06 +0300 Subject: [PATCH 07/10] wip --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f4c66ed..3177f80 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,6 @@ jobs: nodeModules- - name: Install dependencies - if: steps.cache-tests.outputs.cache-hit != 'true' run: npm install env: CI: true From f0efa4601dd0e51b09a141e5be3a45b527aadca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 19:04:49 +0300 Subject: [PATCH 08/10] fix cache --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3177f80..ae4b2f7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,7 @@ jobs: - name: Use cached node_modules id: cache-tests - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: node_modules key: nodeModules-${{ hashFiles('./package-lock.json') }}-${{ matrix.node-version }}-tests @@ -36,6 +36,7 @@ jobs: nodeModules- - name: Install dependencies + if: steps.cache-tests.outputs.cache-hit != 'true' run: npm install env: CI: true From 2aa414864ff6323fdd9fccf4a6971db533255c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 19:11:50 +0300 Subject: [PATCH 09/10] wip --- .github/workflows/tests.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ae4b2f7..9cf6daa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,24 +19,30 @@ jobs: node-version: [12, 14, 16] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} + - name: Get npm cache directory + id: npm-cache-dir + run: | + echo "::set-output name=dir::$(npm config get cache)" + - name: Use cached node_modules - id: cache-tests + id: npm-cache uses: actions/cache@v3 with: - path: node_modules - key: nodeModules-${{ hashFiles('./package-lock.json') }}-${{ matrix.node-version }}-tests + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ matrix.node-version }-${{ hashFiles('**/package-lock.json') }} restore-keys: | - nodeModules- + ${{ runner.os }}-node-${{ matrix.node-version }- + ${{ runner.os }}-node- - name: Install dependencies - if: steps.cache-tests.outputs.cache-hit != 'true' + if: steps.npm-cache.outputs.cache-hit != 'true' run: npm install env: CI: true From 1323e357e6821b915f118fef48f989b91481dfd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20A=C5=9Fan?= Date: Wed, 10 Aug 2022 19:13:01 +0300 Subject: [PATCH 10/10] wip --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9cf6daa..2770ac1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,9 +36,9 @@ jobs: uses: actions/cache@v3 with: path: ${{ steps.npm-cache-dir.outputs.dir }} - key: ${{ runner.os }}-node-${{ matrix.node-version }-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }- + ${{ runner.os }}-node-${{ matrix.node-version }}- ${{ runner.os }}-node- - name: Install dependencies