Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danieldietrich/windify

πŸš€ Toolless Tailwind CSS and Windi CSS, directly in the browser.
https://github.com/danieldietrich/windify

css tailwindcss utility-first windicss

Last synced: about 1 month ago
JSON representation

πŸš€ Toolless Tailwind CSS and Windi CSS, directly in the browser.

Awesome Lists containing this project

README

        

[![npm version](https://img.shields.io/npm/v/windify?logo=npm&style=flat-square)](https://www.npmjs.com/package/windify/)[![brotlied](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/windify.svg?compression=brotli&label=brotlied&max=1500&softmax=1000&style=flat-square)](https://www.jsdelivr.com/package/npm/windify)[![hits/month](https://data.jsdelivr.com/v1/package/npm/windify/badge)](https://www.jsdelivr.com/package/npm/windify)[![license](https://img.shields.io/github/license/danieldietrich/copy?style=flat-square)](https://opensource.org/licenses/MIT/)[![sponsor](https://img.shields.io/badge/GitHub-πŸ’–Sponsors-b5b7b9?logo=github&style=flat-square)](https://github.com/sponsors/danieldietrich)[![follow](https://img.shields.io/twitter/follow/danieldietrich?logo=twitter&style=flat-square)](https://twitter.com/danieldietrich/)



Tailwind CSS


Tailwind CSS

Toolless [Tailwind CSS](https://tailwindcss.com) and [Windi CSS](https://windicss.org), directly in the browser.

## Features

* **Use Tailwind CSS and Windi CSS directly in the browser, no build tools needed!**
* No need to learn anything about NodeJS, just edit and run index.html
* Processes all inline styles and transforms directives like `@apply`
* Prevents FOUC (flash of unstyled content)
* Tracks document changes by running in watch mode by default
* Parses Tailwind CSS directives and replaces them with the corresponding CSS
* Scans the document for Tailwind CSS classes and adds them to the document

Note: Windify internally uses [Windi CSS](https://windicss.org) to generate the CSS. In the following we use _Tailwind CSS_ as a synonym for all tools that support [Tailwind CSS](https://tailwindcss.com) syntax.

## Usage

1. Add Windify `` to your HTML

```html
<!-- umd package -->
<script src="https://cdn.jsdelivr.net/npm/windify">

window.addEventListener('load', () => windify());

import windify from "https://esm.run/windify";
window.addEventListener('load', () => windify());

```

2. Start to use Tailwind CSS / Windi CSS syntax in your HTML

```html

Hello!


```

Windify will process all `` inline styles and transform directives like `@apply`

```html
<style lang="windify">
.hello {
@apply
text-purple-600 font-semibold;
}
}

```

3. Prevent FOUC (flash of unstyled content)

FOUC is prevented by hiding the HTML content until Windify is ready.

We do this by setting the `hidden` attribute on `html`, `body` or the _root_ element (see [options](#options) below).

```html

```

## Options

Windify can be configured with the following options:

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| minify | boolean | true | minify the output |
| parseCss | boolean | true | parse CSS styles `` and process directives like `@apply` |
| preflight | boolean | true | enables CSS reset for descendants of the root element |
| root | HTMLElement | document.body | the DOM element that will be scanned for windi classes |
| watch | boolean | true | enable/disable watch mode, only applies to the root element and its children |
| windiCssVersion | string | 'latest' | Windi CSS version that is used internally to parse and generate CSS |
| config | object | | optional [windicss config](https://windicss.org/guide/configuration.html) |

All configuration properties are optional, choose the defaults you like:

```js
windify({
minify: false,
parseCss: false,
preflight: false,
root: document.querySelector('#root'),
watch: false,
windiCssVersion: '3.4.3',
config: {
...
}
});
```