2.0.2 • Published 4 years ago

preact-pure-tailwindcss v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Preact CLI Tailwind CSS Plugin

This is for using Typescript, Tailwind Css, Purgecss together with Preact.

  • Significantly reduce your size of your bundled CSS (from about 700kb to 1~10kb)
  • Preact Typescript template is required
  • Remove unused css for all components, (js, ts, tsx, jsx)
  • Keep the dependency updated

Usage

npm i preact-cli-tailwind --save-dev

# OR

yarn add preact-cli-tailwind --dev

In your preact.config.js:

const tailwind = require("preact-cli-tailwind");

module.exports = (config, env, helpers) => {
  config = tailwind(config, env, helpers);
  return config;
};

API

Pass in config, env and helpers as forwarded from config.

It also exposes a fourth argument params which allows you to customise the regex provided to Purge CSS.

const tailwind = require("preact-cli-tailwind");

module.exports = (config, env, helpers) => {
  config = tailwind(config, env, helpers, {
    regex: /[\w-/:%]+(?<!:)/g,
  });
  return config;
};

Reference

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago