transform-to-tailwindcss
TypeScript icon, indicating that this package has built-in type declarations

0.0.27 • Public • Published

to tailwindcss

English | 简体中文

This library is to convert css to tailwindcss. tailwindcss can reuse styles better to reduce the packaging volume, which can be converted as a performance optimization method, and it can also make it easier for old projects to upgrade to tailwindcss. If you want to use unocss, you can use transformToUnocss.

📦 Install

  npm i -g transform-to-tailwindcss

🦄 cli

  ## command: totailwindcss + directory
  totailwindcss playground

  ## revoke: totailwindcss + directory + --revert
  totailwindcss payground --revert

🌈 Usage

Vite
// vite.config.ts
import { vitePluginTransformTotailwindcss } from 'transform-to-tailwindcss'
export default defineConfig({
  plugins: [vitePluginTransformTotailwindcss(/* options */)],
})

Rollup
// rollup.config.js
import { resolve } from 'node:path'
import { rollupTransformTotailwindcss } from 'transform-to-tailwindcss'
export default {
  plugins: [rollupTransformTotailwindcss(/* options */)],
}

Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('transform-to-tailwindcss').webpackTransformTotailwindcss({
      /* options */
    }),
  ],
}

Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('transform-to-tailwindcss').webpackTransformTotailwindcss({
        /* options */
      }),
    ],
  },
}

Esbuild
// esbuild.config.js
import { build } from 'esbuild'
import { esbuildTransformTotailwindcss } from 'transform-to-tailwindcss'

build({
  plugins: [esbuildTransformTotailwindcss(/* options */)],
})

⭐ Feature

  • support css in '.html' | '.tsx' | '.vue' | '.astro' | '.svelte' to tailwindcss
  • support sass less stylus convert
  • support vite | rollup | webpack | vue-cli | esbuild
  • vscode extension To tailwindcss

🚁 More

Before

before

After

after

buy me a cup of coffee

License

MIT

Package Sidebar

Install

npm i transform-to-tailwindcss

Weekly Downloads

7

Version

0.0.27

License

MIT

Unpacked Size

38.1 MB

Total Files

17

Last publish

Collaborators

  • simon_he