Skip to content

Commit bf10fed

Browse files
docs(optimization): update optimization file
1 parent 05b2709 commit bf10fed

3 files changed

Lines changed: 16 additions & 21 deletions

File tree

content/customize/optimization.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: home
33
title: Tailwind CSS Optimization - Flowbite
4-
description: Optimize for production by using Purge CSS and remove unused CSS using the Tailwind configuration file
4+
description: Optimize your project for production use by setting up Flowbite and Tailwind CSS using our guide
55
group: customize
66
toc: true
77

@@ -11,35 +11,30 @@ next: Accordion
1111
nextLink: components/accordion/
1212
---
1313

14-
The default development build of FlowBite and Tailwind CSS is roughly 3566.2kB uncompressed, 289.2kB when minified and compressed with Gzip, and 71.3kB when compressed with Brotli.
14+
The default JavaScript development build of Flowbite and Tailwind CSS is roughly 310kB uncompressed, 136kB when minified via CDN.
1515

16-
If you have worked with Tailwind CSS previously, you should already know that you should **use Purge CSS to remove the unused CSS** which was helpful to you when developing.
16+
Although working with the CDN can be quick and effective, it is not the most efficient way of working with Tailwind CSS and Flowbite. You should definitely check our [quickstart guide](https://flowbite.com/docs/getting-started/quickstart/) and set up Tailwind CSS in your local environment so that the only the CSS being used in your templates will be added to the final CSS file.
1717

1818
## Remove unused CSS
1919

20-
First of all, you need to set the type of files that you want to be searched for when purging the CSS.
20+
Since Tailwind v4 you no longer need to set the content paths for your templating files.
2121

22-
```javascript
23-
// tailwind.config.js
24-
module.exports = {
25-
content: [
26-
'./src/**/*.html',
27-
'./src/**/*.vue',
28-
'./src/**/*.jsx',
29-
],
30-
theme: {},
31-
plugins: [],
32-
}
22+
However, you might want to set custom sources for where the engine should look for utility classes.
23+
24+
```css
25+
@import "tailwindcss";
26+
27+
@source "../node_modules/flowbite";
3328
```
3429

35-
The `purge` object should include **all of the files that have classes**, including JavaScript, Markdown, and HTML files.
30+
## Build for production
3631

37-
After that, make sure that you set `NODE_ENV` to `production`.
32+
When building your CSS, make sure that you set `NODE_ENV` to `production`.
3833

3934
The command that you have to run in your terminal for production build would be:
4035

4136
```javascript
42-
NODE_ENV=production npx tailwindcss -o flowbite.css
37+
NODE_ENV=production npx @tailwindcss/cli -i input.css -o output.css
4338
```
4439

45-
Learn more about how to optimize your code for production by reading the official <a href="https://tailwindcss.com/docs/optimizing-for-production">Tailwind CSS guide</a>.
40+
This command will create an `output.css` file that you will include in your templating files.

content/getting-started/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export default {
268268
5. Compile the source CSS file using NPX:
269269

270270
```bash
271-
npx @tailwindcss/cli -i main.css -o styles.css
271+
npx @tailwindcss/cli -i input.css -o output.css
272272
```
273273

274274
Now you should be good to go! Check the <a href="https://tailwindcss.com/docs/upgrade-guide#changes-from-v3" rel="nofollow" target="_blank">deprecated changes from v3</a> to learn more about the new features.

content/getting-started/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export default {
193193
5. Compile the source CSS file using NPX:
194194

195195
```bash
196-
npx @tailwindcss/cli -i main.css -o styles.css
196+
npx @tailwindcss/cli -i input.css -o output.css
197197
```
198198

199199
Now you should be good to go! Check the <a href="https://tailwindcss.com/docs/upgrade-guide#changes-from-v3" rel="nofollow" target="_blank">deprecated changes from v3</a> to learn more about the new features.

0 commit comments

Comments
 (0)