Skip to content

Commit

Permalink
Ensure p styles are inserted before .lead styles (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradlc committed Jan 10, 2023
1 parent fda8ce5 commit a5d0bc2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1294,3 +1294,31 @@ it('ignores common non-trailing pseudo-elements in selectors', () => {
`)
})
})

test('lead styles are inserted after paragraph styles', async () => {
let config = {
content: [{ raw: html`<div class="prose"></div>` }],
}

return run(config).then((result) => {
expect(result.css).toIncludeCss(
css`
.prose {
color: var(--tw-prose-body);
max-width: 65ch;
}
.prose :where(p):not(:where([class~='not-prose'] *)) {
margin-top: 1.25em;
margin-bottom: 1.25em;
}
.prose :where([class~='lead']):not(:where([class~='not-prose'] *)) {
color: var(--tw-prose-lead);
font-size: 1.25em;
line-height: 1.6;
margin-top: 1.2em;
margin-bottom: 1.2em;
}
`
)
})
})
2 changes: 2 additions & 0 deletions src/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,8 @@ module.exports = {
{
color: 'var(--tw-prose-body)',
maxWidth: '65ch',
// TODO: Figure out how to not need this, it's a merging issue
p: {},
'[class~="lead"]': {
color: 'var(--tw-prose-lead)',
},
Expand Down

1 comment on commit a5d0bc2

@vercel
Copy link

@vercel vercel bot commented on a5d0bc2 Jan 10, 2023

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.