diff --git a/site/tests/index.test.ts-snapshots/render-images-with-each-plugins-1-linux.txt b/site/tests/index.test.ts-snapshots/render-images-with-each-plugins-1-linux.txt new file mode 100644 index 0000000..1b6657c --- /dev/null +++ b/site/tests/index.test.ts-snapshots/render-images-with-each-plugins-1-linux.txt @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + svelte-twc + + +

svelte-twc

Overview

+

svelte-twc is a Svelte library that provides a way to use Tailwind CSS classes as components, inspired by TWC.

+

Motivation

+

Svelte is a great framework for building web applications, but it is difficult to use a lot of components with Tailwind CSS classes.

+

With svelte-twc, you can create components with Tailwind CSS classes easily.

+

Installation

+

This library supports only Svelte v5.

+
npm install svelte@next # Use Svelte v5
+npm install svelte-twc
+
+

If you are using VSCode, you can use auto-completion. +Please check TWC documentation.

+

Setup

+

Setup tailwind.css in your project yourself.

+

You need to add the plugin to your Vite config like this:

+
import { sveltekit } from '@sveltejs/kit/vite';
+import { sveltetwc } from 'svelte-twc/vite';
+import { defineConfig } from 'vite';
+
+export default defineConfig({
+	plugins: [sveltekit(), sveltetwc()]
+});
+
+

Usage

+
<script lang="ts">
+	import { twc } from 'svelte-twc';
+	const Button = twc.button`bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600`;
+</script>
+
+<Button>Click me</Button>
+
+

Result:

+ +
<script lang="ts">
+	import { twc } from 'svelte-twc';
+	const colorClass = "bg-gray-200 text-gray-800";
+	const centeredClass = "flex items-center justify-center";
+	const Container = twc.div([colorClass, centeredClass].join(" "));
+</script>
+
+<Container class="font-bold">...</Container>
+
+

Result:

+
<div class="bg-gray-200 text-gray-800 flex items-center justify-center font-bold">...</div>
+
+ + +
+ + + \ No newline at end of file diff --git a/site/tests/index.test.ts-snapshots/render-images-with-each-plugins-2-linux.png b/site/tests/index.test.ts-snapshots/render-images-with-each-plugins-2-linux.png new file mode 100644 index 0000000..b532d96 Binary files /dev/null and b/site/tests/index.test.ts-snapshots/render-images-with-each-plugins-2-linux.png differ