Skip to content

Commit 060bed3

Browse files
authored
Merge pull request #28 from ahaseeb04/master
Allow a custom class name to be passed in
2 parents 385f854 + d6e2c17 commit 060bed3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ function configToCss(config) {
1818
}
1919

2020
module.exports = plugin.withOptions(
21-
({ modifiers = ['sm', 'lg', 'xl', '2xl'] } = {}) => {
21+
({ modifiers = ['sm', 'lg', 'xl', '2xl'], className = 'prose' } = {}) => {
2222
return function ({ addComponents, theme, variants }) {
2323
const config = theme('typography', {})
2424

2525
addComponents(
2626
[
2727
{
28-
'.prose': merge(...castArray(styles.default.css), configToCss(config.default || {})),
28+
[`.${className}`]: merge(...castArray(styles.default.css), configToCss(config.default || {})),
2929
},
3030
...modifiers.map((modifier) => ({
31-
[`.prose-${modifier}`]: merge(
31+
[`.${className}-${modifier}`]: merge(
3232
...castArray(styles[modifier].css),
3333
configToCss(config[modifier] || {})
3434
),
3535
})),
3636
...Object.keys(config)
3737
.filter((key) => !['default', ...modifiers].includes(key))
3838
.map((modifier) => ({
39-
[`.prose-${modifier}`]: configToCss(config[modifier]),
39+
[`.${className}-${modifier}`]: configToCss(config[modifier]),
4040
})),
4141
],
4242
variants('typography')

0 commit comments

Comments
 (0)