Files
sweet/docs/canary/plugins/tailwindcss.md
T

1.3 KiB

description
description
Use Tailwindcss to style your app

Tailwindcss is a utility-first CSS framework that generates CSS out of the class names that are used in JSX. Since we use Tailwindcss ourselves here at Deno, Fresh ships with an official plugin for that.

Usage

  1. Set nodeModulesDir in deno.json to "auto" or "manual"
  {
    "name": "@example/my-cool-project"
+   "nodeModulesDir": "auto",
    "imports": {
      ...
    }
  }
  1. Run deno install jsr:@fresh/plugin-tailwind
  2. Update dev.ts:
  import { Builder } from "fresh/dev";
  import { app } from "./main.ts";
+ import { tailwind } from "@fresh/plugin-tailwind";
  
  const builder = new Builder();
+ tailwind(builder, app);
  1. Add @import "tailwindcss"; at the top of your main stylesheet.

For more information on how to use tailwindcss, check out their documentation.

Options

You can customize the tailwind plugin via the following options:

tailwind(builder, app, {
  // Exclude certain files from processing
  exclude: ["/admin/**", "*.temp.css"],
  // Force optimization (defaults to production mode)
  optimize: true,
  // Exclude base styles
  base: null,
});