Skip to content

Commit

Permalink
Fix prose elements legacy mode. Fixes #258 (#259)
Browse files Browse the repository at this point in the history
* Fix prose elements `legacy` mode. Fixes #258

* Add test

* Fix legacy mode custom element selectors

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
  • Loading branch information
Folyd and thecrypticace committed Mar 25, 2022
1 parent c346878 commit 1874110
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -117,7 +117,7 @@ module.exports = plugin.withOptions(
['video'],
['hr'],
]) {
addVariant(`${className}-${name}`, `& :is(${inWhere(selector, options)})`)
addVariant(`${className}-${name}`, target === 'legacy' ? `& ${selector}` : `& :is(${inWhere(selector, options)})`)
}

addComponents(
Expand Down
5 changes: 4 additions & 1 deletion src/index.test.js
Expand Up @@ -335,7 +335,7 @@ test('modifiers', async () => {
test('legacy target', async () => {
let config = {
plugins: [typographyPlugin({ target: 'legacy' })],
content: [{ raw: html`<div class="prose"></div>` }],
content: [{ raw: html`<div class="prose prose-h1:text-center"></div>` }],
theme: {
typography: {
DEFAULT: {
Expand Down Expand Up @@ -423,6 +423,9 @@ test('legacy target', async () => {
.prose code::after {
content: '&#96;';
}
.prose-h1\:text-center h1 {
text-align: center;
}
`
)
})
Expand Down

1 comment on commit 1874110

@vercel
Copy link

@vercel vercel bot commented on 1874110 Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.