Skip to content

Commit 97df742

Browse files
authored
Merge pull request #38 from mertasan/case-sensitive
Add uppercase support to keys
2 parents cdbe8a4 + 1323e35 commit 97df742

File tree

11 files changed

+63
-18
lines changed

11 files changed

+63
-18
lines changed

.github/workflows/tests.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,30 @@ jobs:
1919
node-version: [12, 14, 16]
2020

2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v3
2323

2424
- name: Use Node ${{ matrix.node-version }}
2525
uses: actions/setup-node@v2
2626
with:
2727
node-version: ${{ matrix.node-version }}
2828

29+
- name: Get npm cache directory
30+
id: npm-cache-dir
31+
run: |
32+
echo "::set-output name=dir::$(npm config get cache)"
33+
2934
- name: Use cached node_modules
30-
id: cache-tests
31-
uses: actions/cache@v2
35+
id: npm-cache
36+
uses: actions/cache@v3
3237
with:
33-
path: node_modules
34-
key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }}-tests
38+
path: ${{ steps.npm-cache-dir.outputs.dir }}
39+
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
3540
restore-keys: |
36-
nodeModules-
41+
${{ runner.os }}-node-${{ matrix.node-version }}-
42+
${{ runner.os }}-node-
3743
3844
- name: Install dependencies
39-
if: steps.cache-tests.outputs.cache-hit != 'true'
45+
if: steps.npm-cache.outputs.cache-hit != 'true'
4046
run: npm install
4147
env:
4248
CI: true

__tests__/issues.test.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,42 @@ test('issue 25', async () => {
114114
"
115115
`)
116116
})
117+
118+
test('issue 37', async () => {
119+
expect(
120+
await utils.diffOnly({
121+
content: [utils.content()],
122+
darkMode: 'class',
123+
theme: {
124+
variables: {
125+
DEFAULT: {
126+
ONE: 'red',
127+
TWO: {
128+
DEFAULT: 'black',
129+
FOObar: 'green',
130+
THREE: {
131+
FOUR: 'white',
132+
five: 'blue',
133+
},
134+
},
135+
},
136+
},
137+
},
138+
139+
plugins: [tailwindcssVariables()],
140+
})
141+
).toMatchInlineSnapshot(`
142+
"
143+
144+
145+
+ :root {
146+
+ --ONE: red;
147+
+ --TWO: black;
148+
+ --TWO-FOObar: green;
149+
+ --TWO-THREE-FOUR: white;
150+
+ --TWO-THREE-five: blue
151+
+ }
152+
153+
"
154+
`)
155+
})

examples/color-variable-helper/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@mertasan/tailwindcss-variables": "latest",
1010
"autoprefixer": "^10.4.0",
1111
"postcss": "^8.4.4",
12-
"tailwindcss": "^3.0.0"
12+
"tailwindcss": "^3.0.11"
1313
},
1414
"license": "MIT"
1515
}

examples/dark-custom-selector/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@mertasan/tailwindcss-variables": "latest",
1010
"autoprefixer": "^10.4.0",
1111
"postcss": "^8.4.4",
12-
"tailwindcss": "^3.0.0"
12+
"tailwindcss": "^3.0.11"
1313
},
1414
"license": "MIT"
1515
}

examples/dark-with-class-to-root/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@mertasan/tailwindcss-variables": "latest",
1010
"autoprefixer": "^10.4.0",
1111
"postcss": "^8.4.4",
12-
"tailwindcss": "^3.0.0"
12+
"tailwindcss": "^3.0.11"
1313
},
1414
"license": "MIT"
1515
}

examples/dark-with-class/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@mertasan/tailwindcss-variables": "latest",
1010
"autoprefixer": "^10.4.0",
1111
"postcss": "^8.4.4",
12-
"tailwindcss": "^3.0.0"
12+
"tailwindcss": "^3.0.11"
1313
},
1414
"license": "MIT"
1515
}

examples/dark-with-media/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@mertasan/tailwindcss-variables": "latest",
1010
"autoprefixer": "^10.4.0",
1111
"postcss": "^8.4.4",
12-
"tailwindcss": "^3.0.0"
12+
"tailwindcss": "^3.0.11"
1313
},
1414
"license": "MIT"
1515
}

examples/prefix/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@mertasan/tailwindcss-variables": "latest",
1010
"autoprefixer": "^10.4.0",
1111
"postcss": "^8.4.4",
12-
"tailwindcss": "^3.0.0"
12+
"tailwindcss": "^3.0.11"
1313
},
1414
"license": "MIT"
1515
}

examples/simple/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@mertasan/tailwindcss-variables": "latest",
1010
"autoprefixer": "^10.4.0",
1111
"postcss": "^8.4.4",
12-
"tailwindcss": "^3.0.0"
12+
"tailwindcss": "^3.0.11"
1313
},
1414
"license": "MIT"
1515
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mertasan/tailwindcss-variables",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "Easily create css variables without the need for a css file!",
55
"main": "src/index.js",
66
"license": "GPL-3.0-or-later",
@@ -48,7 +48,7 @@
4848
"postcss-import": "^14.1.0",
4949
"prettier": "^2.5.0",
5050
"snapshot-diff": "^0.9.0",
51-
"tailwindcss": "^3.0.0"
51+
"tailwindcss": "^3.0.11"
5252
},
5353
"peerDependencies": {
5454
"autoprefixer": "^10.0.2",

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ const formatVariableKey = (key) => {
4242
if (key === 'DEFAULT') {
4343
return ''
4444
}
45-
key = key.toLowerCase()
45+
key = key.toString()
4646
return key
4747
.replace(/_/g, '-')
48-
.replace(/[^a-z0-9\-]+/gi, '')
48+
.replace(/[^a-zA-Z0-9\-]+/gi, '')
4949
.replace('---', '--')
5050
}
5151

0 commit comments

Comments
 (0)