Skip to content

Commit a5d0bc2

Browse files
authored
Ensure p styles are inserted before .lead styles (#294)
1 parent fda8ce5 commit a5d0bc2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/index.test.js

+28
Original file line numberDiff line numberDiff line change
@@ -1294,3 +1294,31 @@ it('ignores common non-trailing pseudo-elements in selectors', () => {
12941294
`)
12951295
})
12961296
})
1297+
1298+
test('lead styles are inserted after paragraph styles', async () => {
1299+
let config = {
1300+
content: [{ raw: html`<div class="prose"></div>` }],
1301+
}
1302+
1303+
return run(config).then((result) => {
1304+
expect(result.css).toIncludeCss(
1305+
css`
1306+
.prose {
1307+
color: var(--tw-prose-body);
1308+
max-width: 65ch;
1309+
}
1310+
.prose :where(p):not(:where([class~='not-prose'] *)) {
1311+
margin-top: 1.25em;
1312+
margin-bottom: 1.25em;
1313+
}
1314+
.prose :where([class~='lead']):not(:where([class~='not-prose'] *)) {
1315+
color: var(--tw-prose-lead);
1316+
font-size: 1.25em;
1317+
line-height: 1.6;
1318+
margin-top: 1.2em;
1319+
margin-bottom: 1.2em;
1320+
}
1321+
`
1322+
)
1323+
})
1324+
})

src/styles.js

+2
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,8 @@ module.exports = {
12371237
{
12381238
color: 'var(--tw-prose-body)',
12391239
maxWidth: '65ch',
1240+
// TODO: Figure out how to not need this, it's a merging issue
1241+
p: {},
12401242
'[class~="lead"]': {
12411243
color: 'var(--tw-prose-lead)',
12421244
},

0 commit comments

Comments
 (0)