Skip to content

Commit 9528bc4

Browse files
authored
Merge pull request tailwindlabs#5 from EmilTholin/prefix_function_docs
Document the function prefix feature
2 parents be0dafc + 0b1d1a2 commit 9528bc4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

source/docs/configuration.blade.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,24 @@ For example, you could add a `tw-` prefix by setting the `prefix` option like so
234234
}
235235
```
236236

237+
+You can also pass a function to the `prefix` option if you need more fine-grained control:
238+
239+
```js
240+
{
241+
// ...
242+
options: {
243+
prefix: function (selector) {
244+
if (selector === '.container') {
245+
return 'tw-'
246+
}
247+
248+
return ''
249+
},
250+
// ...
251+
}
252+
}
253+
```
254+
237255
It's important to understand that this prefix is added to the beginning of each *utility* name, not to the entire class name.
238256

239257
That means that classes with responsive or state prefixes like `sm:` or `hover:` will still have the responsive or state prefix *first*, with your custom prefix appearing after the colon:

0 commit comments

Comments
 (0)