Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 33be651

Browse files
committedFeb 21, 2022
fix: correct named container output
1 parent 10e3a7b commit 33be651

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tailwindcss-container-query",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "A plugin that provides CSS Container Queries.",
55
"main": "src/index.js",
66
"author": "Doğukan Çavuş <dgknca@gmail.com>",

‎src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const containerQuery = plugin(
5050
cqRule.append(container.nodes)
5151
container.append(cqRule)
5252
cqRule.walkRules(rule => {
53-
rule.selector = `.${e(`cq-w-${queryName}${separator}`)}${rule.selector.slice(1)}`
53+
rule.selector = `.${e(`cq-w-${nameKey}-${queryName}${separator}`)}${rule.selector.slice(1)}`
5454
})
5555
})
5656
})
@@ -74,7 +74,7 @@ const containerQuery = plugin(
7474
cqRule.append(container.nodes)
7575
container.append(cqRule)
7676
cqRule.walkRules(rule => {
77-
rule.selector = `.${e(`cq-h-${queryName}${separator}`)}${rule.selector.slice(1)}`
77+
rule.selector = `.${e(`cq-h-${nameKey}-${queryName}${separator}`)}${rule.selector.slice(1)}`
7878
})
7979
})
8080
})

‎test/index.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,18 @@ it('should create the `container-name-sidebar` class', () => {
154154
it('should create a named container query at-rule', () => {
155155
const config = {
156156
...defaultOptions,
157-
content: [{ raw: String.raw`<div class="cq-w-sidebar-22:bg-yellow-200"></div>` }],
157+
content: [{ raw: String.raw`<div class="cq-w-sd-22:bg-yellow-200"></div>` }],
158158
theme: {
159159
containerName: {
160-
sidebar: 'sidebar'
160+
sd: 'sidebar'
161161
}
162162
},
163163
}
164164

165165
return run('@tailwind utilities;', config).then((result) => {
166166
expect(result.css).toMatchCss(String.raw`
167167
@container sidebar (min-width: 352px) {
168-
.cq-w-22\:bg-yellow-200 {
168+
.cq-w-sd-22\:bg-yellow-200 {
169169
--tw-bg-opacity: 1;
170170
background-color: rgb(254 240 138 / var(--tw-bg-opacity));
171171
}

0 commit comments

Comments
 (0)
Please sign in to comment.