-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy patheleventy.tsx
163 lines (156 loc) · 3.97 KB
/
eleventy.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import { css, html, js, Page, shell, Step, Tile } from "./utils";
import Logo from "@/docs/img/guides/eleventy-white.react.svg";
export let tile: Tile = {
title: "Eleventy",
description: "Eleventy is a simpler static site generator",
Logo,
};
export let page: Page = {
title: "Install Tailwind CSS with Eleventy",
description: "Setting up Tailwind CSS in an Eleventy project.",
};
export let steps: Step[] = [
{
title: "Create your project",
body: (
<p>
Start by creating a new Eleventy project if you don’t have one set up already. The most common approach is outlined in their{" "}
<a href="https://www.11ty.dev/docs/">getting started guide</a>.
</p>
),
code: {
name: "Terminal",
lang: "shell",
code: shell`
mkdir my-project
cd my-project
npm init -y
npm pkg set type="module"
npm install @11ty/eleventy
mkdir src
touch src/index.html
`,
},
},
{
title: "Install Tailwind CSS",
body: (
<p>
Install <code>@tailwindcss/vite</code> and its peer dependencies via npm.
</p>
),
code: {
name: "Terminal",
lang: "shell",
code: shell`
npm install tailwindcss @tailwindcss/vite
`,
},
},
{
title: "Install the Eleventy Vite Plugin",
body: (
<p>
Install <code>@11ty/eleventy-plugin-vite</code> and its peer dependencies via npm.
</p>
),
code: {
name: "Terminal",
lang: "shell",
code: shell`
npm install @11ty/eleventy-plugin-vite
`,
},
},
{
title: "Import Tailwind CSS",
body: (
<p>
Create <code>src/styles.css</code> file and add an <code>@import</code> for Tailwind CSS.
</p>
),
code: {
name: "src/styles.css",
lang: "css",
code: css`
@import "tailwindcss";
`,
},
},
{
title: "Configure Eleventy",
body: (
<p>
Create a <code>eleventy.config.js</code> file in your project root, and add the <code>@11ty/eleventy-plugin-vite</code>{" "} and <code>@11ty/eleventy-plugin-vite</code>{" "}
plugin. Include an <code>addPassthroughCopy</code> to copy your CSS to the output folder.
</p>
),
code: {
name: "eleventy.config.js",
lang: "js",
code: js`
import EleventyVitePlugin from "@11ty/eleventy-plugin-vite";
import tailwindcss from '@tailwindcss/vite'
export default (eleventyConfig) => {
eleventyConfig.addPassthroughCopy("src/styles.css");
eleventyConfig.addPlugin(EleventyVitePlugin, {
viteOptions: {
plugins: [ tailwindcss() ]
}
});
};
export const config = {
dir: {
input: "src",
},
};
`,
},
},
{
title: "Start your build process",
body: (
<p>
Run your build process with <code>npx eleventy --serve</code>.
</p>
),
code: {
name: "Terminal",
lang: "shell",
code: shell`
npx eleventy --serve
`,
},
},
{
title: "Start using Tailwind in your project",
body: (
<p>
Add your CSS file to the <code>{"<head>"}</code> and start using Tailwind’s utility classes to style your
content.
</p>
),
code: {
name: "src/index.html",
lang: "html",
code: html`
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- [!code highlight:2] -->
<link href="./styles.css" type="text/css" rel="stylesheet" />
</head>
<body>
<!-- [!code highlight:4] -->
<h1 class="text-3xl font-bold underline text-amber-500">
<!-- prettier-ignore -->
Hello world!
</h1>
</body>
</html>
`,
},
},
];