All Projects โ†’ Arthie โ†’ Xwind

Arthie / Xwind

Licence: mit
Tailwind CSS as a templating language in JS and CSS-in-JS

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Xwind

Twin.macro
๐Ÿฆนโ€โ™‚๏ธ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, stitches and goober) at build time.
Stars: โœญ 5,137 (+1963.05%)
Mutual labels:  babel, tailwindcss, css-in-js, emotion
Babel Plugin Tailwind Components
Use Tailwind with any CSS-in-JS library
Stars: โœญ 320 (+28.51%)
Mutual labels:  babel, babel-plugin, tailwindcss, css-in-js
benefit
โœจ Utility CSS-in-JS library that provides a set of low-level, configurable, ready-to-use styles
Stars: โœญ 51 (-79.52%)
Mutual labels:  emotion, css-in-js, tailwindcss
Xstyled
A utility-first CSS-in-JS framework built for React. ๐Ÿ’…๐Ÿ‘ฉโ€๐ŸŽคโšก๏ธ
Stars: โœญ 1,835 (+636.95%)
Mutual labels:  tailwindcss, css-in-js, emotion
Emotion
๐Ÿ‘ฉโ€๐ŸŽค CSS-in-JS library designed for high performance style composition
Stars: โœญ 14,177 (+5593.57%)
Mutual labels:  babel-plugin, css-in-js, emotion
Postjss
Use the power of PostCSS in compiling with JSS
Stars: โœญ 40 (-83.94%)
Mutual labels:  babel, babel-plugin, css-in-js
Compiled
A familiar and performant compile time CSS-in-JS library for React.
Stars: โœญ 1,235 (+395.98%)
Mutual labels:  babel, babel-plugin, css-in-js
Babel Plugin Polished
Compile polished helper functions at build time
Stars: โœญ 133 (-46.59%)
Mutual labels:  babel, babel-plugin
Next Dark Mode
๐ŸŒ‘ Enable dark mode for Next.js apps
Stars: โœญ 133 (-46.59%)
Mutual labels:  css-in-js, emotion
Goober
๐Ÿฅœ goober, a less than 1KB ๐ŸŽ‰ css-in-js alternative with a familiar API
Stars: โœญ 2,317 (+830.52%)
Mutual labels:  css-in-js, emotion
Param.macro
Partial application syntax and lambda parameters for JavaScript, inspired by Scala's `_` & Kotlin's `it`
Stars: โœญ 170 (-31.73%)
Mutual labels:  babel, babel-plugin
React Next Boilerplate
๐Ÿš€ A basis for reducing the configuration of your projects with nextJS, best development practices and popular libraries in the developer community.
Stars: โœญ 129 (-48.19%)
Mutual labels:  css-in-js, emotion
Babel Plugin Prismjs
A babel plugin to use PrismJS with standard bundlers.
Stars: โœญ 114 (-54.22%)
Mutual labels:  babel, babel-plugin
Filbert Js
A lightweight(~1kb) css-in-js framework
Stars: โœญ 167 (-32.93%)
Mutual labels:  css-in-js, emotion
Styled Ppx
Typed styled components in Reason, OCaml and ReScript
Stars: โœญ 236 (-5.22%)
Mutual labels:  css-in-js, emotion
Babel Plugin Transform Typescript Metadata
Babel plugin to emit decorator metadata like typescript compiler
Stars: โœญ 142 (-42.97%)
Mutual labels:  babel, babel-plugin
Babel Plugin Runtyper
โšก๏ธ Runtime type-checker for JavaScript
Stars: โœญ 117 (-53.01%)
Mutual labels:  babel, babel-plugin
Babel Plugin React Html Attrs
Babel plugin which transforms HTML and SVG attributes on JSX host elements into React-compatible attributes
Stars: โœญ 170 (-31.73%)
Mutual labels:  babel, babel-plugin
Grid
This package has moved and renamed
Stars: โœญ 2,079 (+734.94%)
Mutual labels:  css-in-js, emotion
Eslint Import Resolver Babel Module
Custom eslint resolve for babel-plugin-module-resolver
Stars: โœญ 236 (-5.22%)
Mutual labels:  babel, babel-plugin

tailwindcssinjs

This repo contains a collection of packages that makes the integration of Tailwind with CSS-in-JS libraries easier.

Why does this exist?

You may have encountered some of these problems when using Tailwind with CSS-in-JS libraries.

  • You have to use PurgeCSS to get the minimal CSS file, PurgeCSS relies on string matching
  • No warnings when misspelling, refactoring or using a class that doesn't exist
  • Inline classes can get very long and hard to read
  • You have to specify the variants for utility classes in tailwind.config.js

Features / Goals

  • Solve all of the above problems
  • Automatically compatible with latest Tailwind version 2.X.X
  • New syntax to apply variants to multiple utility classes md:hover[text-xs font-normal]
  • Reacts to changes in made in tailwind.config.js
  • Great developer experience with VS Code extension or typescript-xwind-plugin
  • No runtime impact all transformations happen during build time
  • Plugins to support any/your favorite CSS-in-JS syntax

Support for all Tailwind features:

  • All utility and component classes
  • All variant utility classes enabled
  • Full support for custom classes and tailwind.config.js customization
  • Supports Tailwind plugins (@tailwindcss/typography, @tailwindcss/forms, ...)

Packages

xwind

xwind uses a babel plugin that transforms Tailwind classes into CSS object styles or a classes string. The CSS object styles output can be used with your favorite CSS-in-JS library like emotion, styled-components ... The classes string output can be used with the xwind cli to generate a minimal css file of the used Tailwind classes.

Output mode "objectstyles" example

import xw from "xwind";

const styles = xw`text-red-100 hover:text-green-100 hover:bg-blue-200`;
// OR (with custom array syntax)
const styles = xw`text-red-100 hover[text-green-100 bg-blue-200]`;

Transforms by default into Postcss-js / JSS compatible syntax:

const styles = {
  "--text-opacity": "1",
  color: ["#fde8e8", "rgba(253, 232, 232, var(--text-opacity))"],
  "&:hover": {
    "--text-opacity": "1",
    "--bg-opacity": "1",
    color: ["#def7ec", "rgba(222, 247, 236, var(--text-opacity))"],
    backgroundColor: ["#c3ddfd", "rgba(195, 221, 253, var(--bg-opacity))"],
  },
};

Transform to CSS string syntax with the css plugin:

const styles = `
  --text-opacity: 1;
  color: #fde8e8;
  color: rgba(253, 232, 232, var(--text-opacity));
  &:hover {
    --text-opacity: 1;
    --bg-opacity: 1;
    color: #def7ec;
    color: rgba(222, 247, 236, var(--text-opacity));
    background-color: #c3ddfd;
    background-color: rgba(195, 221, 253, var(--bg-opacity));
  }
`;

objectstyles plugins make it possible to support any CSS-in-JS library syntax.

Output mode "classes" example

import xw from "xwind";

const styles = xw`text-red-100 hover:text-green-100 hover:bg-blue-200`;
// OR (with custom array syntax)
const styles = xw`text-red-100 hover[text-green-100 bg-blue-200]`;

Transforms into a classes string:

const styles = "text-red-100 hover:text-green-100 hover:bg-blue-200";

Generate the css output with with the xwind cli:

npx run xwind

Output file "/src/styles/xwind.css":

/*! Generated with xwind | https://github.com/arthie/xwind */
.hover\:bg-blue-200:hover {
  --tw-bg-opacity: 1;
  background-color: rgba(191, 219, 254, var(--tw-bg-opacity));
}
.text-red-100 {
  --tw-text-opacity: 1;
  color: rgba(254, 226, 226, var(--tw-text-opacity));
}
.hover\:text-green-100:hover {
  --tw-text-opacity: 1;
  color: rgba(220, 252, 231, var(--tw-text-opacity));
}

Full xwind package documentation


typescript-xwind-plugin

This package is a typescript language service plugin that adds editor support for xwind tagged template syntax: xw`...` or tw`...`

autocomplete


xwind VS Code extension

This extension activates typescript-xwind-plugin inside VS Code's Typescript language service.

Developer packages

Want to create Tailwind tools with javascript? Have a look at these packages they make the xwind and typescript-xwind-plugin possible.

@xwind/class-utilities

The class-utilities package contains flexible utilities to compose and parse Tailwind classes.


@xwind/core (WIP)

The core package uses Tailwind internals to extracts/generate all the data you could want from Tailwind. It provides the data in a structured way with the necessary utilities to create and manipulate this data.

Non-Affiliation disclaimer

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Tailwind Labs Inc., or any of its subsidiaries or its affiliates. The name Tailwind as well as related names, marks, emblems and images are registered trademarks of their respective owners.

The official Tailwind website can be found at https://tailwindcss.com/.

Please contact the project ower if there are any concerns regarding: Tailwind CSS brand assets and usage guidelines.

License

MIT. Copyright (c) 2020 Arthur Petrie.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].