Skip to content
This repository has been archived by the owner on Apr 30, 2022. It is now read-only.

adeira/babel-plugin-transform-sx-tailwind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transformation of SX Tailwind helpers into direct SX calls.

This has a positive impact on the final bundle size because the huge Tailwind definitions file can be omitted.

How does it work

import React from 'react';
+ import sx from '@adeira/sx';

export default function Example() {
  return (
    <button
-      sxt="bg-blue-500 text-white font-bold"
+      className={__styles('bg-blue-500', 'text-white', 'font-bold')}
      type="button"
    >
      Button
    </button>
  );
}

+ const __styles = sx.create({
+   'bg-blue-500': {
+     backgroundColor: '#4299e1',
+   },
+   'text-white': {
+     color: '#fff',
+   },
+   'font-bold': {
+     fontWeight: 700,
+   },
+ });

Install

yarn add --dev @adeira/babel-plugin-transform-sx-tailwind

Register in your Babel config (e.g. .babelrc):

{
  "plugins": ["@adeira/babel-plugin-transform-sx-tailwind"]
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published