Skip to content

POSTHTML plugin to auto-prefix class names using tailwinds prefix option

Notifications You must be signed in to change notification settings

kevinruscoe/tailwind-posthtml-auto-tw-prefixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TL;DR

It uses postHTML to turn ...

<div class="flex items-center">
  some text
</div>

into ...

  <div class="tw-flex tw-items-center">
    some text
  </div>

.

Because sometimes you'll end up writing CSS/HTML with tailwind, then you have to utilise it's prefix option because of conflicting class names. This just saves you having to update all your class names.

Use it with

const posthtml = require('posthtml')

const html = `
  <div class="flex items-center">
    some text
  </div>
`

const result = posthtml()
  .use(require('./tailwind-posthtml-auto-tw-prefixer.js')())
  .process(html, { sync: true })
  .html

console.log(result)

About

POSTHTML plugin to auto-prefix class names using tailwinds prefix option

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published