Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twind

Package Overview
Dependencies
Maintainers
2
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twind

tailwindcss compat based on twind

  • 1.0.0-next.15
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.9K
decreased by-14.66%
Maintainers
2
Weekly downloads
 
Created
Source

twind


READ THIS FIRST!

Twind v1 is still in beta. Expect bugs!

Twind v1 is a complete rewrite aiming to be compatible with Tailwind v3 classes


Tailwind right in the browser without any build step.

Usage

npm i twind@next
import { setup } from 'twind'

// You must call setup atleast once, but can call it multiple times
setup({
  /* options */
})

Incase you are not using SSR to inject the pre-computed styles apply the following pattern to prevent FOUC:

<body class="!block" style="display: none">
  <!-- ... -->
</body>

Script tag without a build step

Add this line to your index.html:

<head>
  <!-- ... -->
  <script src="https://cdn.jsdelivr.net/npm/twind@next" crossorigin></script>
  <!-- ... -->
</head>

To configure Twind add a script block after the previous one (optional):

<script>
  twind.setup({
    presets: [
      // custom presets...
    ],
    theme: {
      extend: {
        colors: {
          clifford: '#da373d',
        },
      },
    },
    rules: [
      // custom rules...
    ],
    // ...
  })
</script>

Presets

To add another preset add its script after the current one:

<head>
  <!-- ... -->
  <script src="https://cdn.jsdelivr.net/npm/twind@next" crossorigin></script>
  <script src="https://cdn.jsdelivr.net/npm/@twind/preset-ext@next" crossorigin></script>
  <script>
    twind.setup({
      presets: [twind_presetExt()],
      // ...
    })
  </script>
  <!-- ... -->
</head>

API: accessible through the global twind variable

twind/cdn

A drop-in replacement for Tailwind CSS Play CDN that is almost 6 times smaller (96.4kb vs 16.9kB).

import { setup } from 'twind/play-cdn'
<script src="https://cdn.jsdelivr.net/npm/twind@next/cdn.global.js" crossorigin></script>

Presets

API — accessible through the global twind variable

twind/core

import { setup } from 'twind/core'
<script src="https://cdn.jsdelivr.net/npm/twind@next/core.global.js" crossorigin></script>

Presets

None

API — accessible through the global twind variable

API

setup(config [, sheet [, target]])

Can be called as many times as you want.

Keywords

FAQs

Package last updated on 18 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc