Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,090 --> 00:00:03,190
In this lecture, we're going to install Tailwind.
2
00:00:03,210 --> 00:00:09,360
It's necessary to install tailwind because the static template uses a lot of the classes defined by
3
00:00:09,360 --> 00:00:10,220
Tailwind.
4
00:00:10,230 --> 00:00:15,680
If we want the same stylings to appear in the application, we'll need to install it.
5
00:00:15,690 --> 00:00:20,070
There are two options for adding tailwind to a View project.
6
00:00:20,100 --> 00:00:25,610
The first option is to link the style sheets from the indexed HTML file.
7
00:00:25,680 --> 00:00:27,330
This is what we did before.
8
00:00:27,360 --> 00:00:29,610
It's a decent solution, but it's not.
9
00:00:29,610 --> 00:00:32,250
The approach will take for this project.
10
00:00:32,369 --> 00:00:35,400
Vite should process our CSS files.
11
00:00:35,400 --> 00:00:40,890
This project is going to contain a lot of code which will mean a large file size.
12
00:00:40,890 --> 00:00:46,080
We should take every opportunity to optimize our code, including CSS.
13
00:00:46,080 --> 00:00:50,790
If we want VITE to process the code, we must do things differently.
14
00:00:51,090 --> 00:00:54,030
This is why we will go with the second option.
15
00:00:54,030 --> 00:00:56,640
Tailwind can be installed with NPM.
16
00:00:56,640 --> 00:01:02,880
Best of all, this package has a command for helping us create configuration files for tailwind.
17
00:01:02,880 --> 00:01:04,349
Let's give it a try.
18
00:01:04,349 --> 00:01:11,040
In the resource section of this lecture, I provide a link to a guide for installing tailwind with vite.
19
00:01:13,170 --> 00:01:17,100
We're going to be following these steps for installing tailwind.
20
00:01:17,130 --> 00:01:20,990
Feel free to pause the video and try these steps yourself.
21
00:01:21,000 --> 00:01:23,450
Otherwise, let's go through it together.
22
00:01:23,460 --> 00:01:26,180
Head back to the editor in the command line.
23
00:01:26,190 --> 00:01:27,360
Stop the server.
24
00:01:27,390 --> 00:01:29,820
It shouldn't be running during installation.
25
00:01:29,820 --> 00:01:35,400
Next run the following command and pm ie minus dh tailwind.
26
00:01:35,430 --> 00:01:36,840
CSS post.
27
00:01:36,840 --> 00:01:39,040
CSS auto pre fixer.
28
00:01:41,420 --> 00:01:48,030
We're installing three packages which are tailwind posts CSS and auto pre fixer.
29
00:01:48,080 --> 00:01:50,870
All will be necessary for running tailwind.
30
00:01:50,870 --> 00:01:56,610
Behind the scenes, Tailwind uses post CSIS for creating its classes.
31
00:01:56,630 --> 00:01:59,840
These packages should have been installed successfully.
32
00:01:59,870 --> 00:02:04,640
The next step is to run the following command and ppc's tailwind.
33
00:02:04,670 --> 00:02:07,310
CSIS init minus p.
34
00:02:09,630 --> 00:02:15,350
This command will generate the configuration files for tailwind and post CSS.
35
00:02:15,360 --> 00:02:19,800
The post CSS configuration file does not have anything special.
36
00:02:19,800 --> 00:02:22,350
Let's focus on the Tailwind file.
37
00:02:22,350 --> 00:02:29,580
In our project's root directory, there's a new file called Tailwind dot config dot js.
38
00:02:31,840 --> 00:02:35,120
This is the official file for configuring tailwind.
39
00:02:35,140 --> 00:02:40,030
Through this file we can modify tailwinds classes with JavaScript.
40
00:02:40,060 --> 00:02:41,900
Sounds strange, right?
41
00:02:41,920 --> 00:02:49,840
Like I said before, tailwind uses post CSS, which is a library for converting CSS into JavaScript.
42
00:02:49,870 --> 00:02:54,460
You can think of tailwind as one large post CSS plugin.
43
00:02:54,460 --> 00:02:57,910
It'll inject a series of classes into our application.
44
00:02:57,910 --> 00:03:05,140
We can modify colors, breakpoints, font, families, etc. Let's review the configuration settings
45
00:03:05,140 --> 00:03:05,860
together.
46
00:03:06,040 --> 00:03:08,800
The first option is called content.
47
00:03:08,830 --> 00:03:15,040
During the bundling process, Tailwind will search for its classes from within our project.
48
00:03:15,040 --> 00:03:18,820
It'll generate a list of classes used by our app.
49
00:03:18,820 --> 00:03:22,000
These classes will be added to the final bundle.
50
00:03:22,000 --> 00:03:24,490
What about the other classes from Tailwind?
51
00:03:24,490 --> 00:03:28,750
They'll be removed before Tailwind can produce a bundle.
52
00:03:28,750 --> 00:03:31,660
It needs to know where it can find our files.
53
00:03:31,780 --> 00:03:36,490
The content option is an array of files to search for tailwind classes.
54
00:03:36,490 --> 00:03:38,260
By default, it's empty.
55
00:03:38,260 --> 00:03:40,930
Let's head back to the installation page.
56
00:03:43,040 --> 00:03:44,120
On this page.
57
00:03:44,120 --> 00:03:46,140
There's an example from the guide.
58
00:03:46,160 --> 00:03:48,940
You can find the example from step three.
59
00:03:48,950 --> 00:03:51,230
Copy the items in the example.
60
00:03:53,330 --> 00:03:54,080
Next.
61
00:03:54,110 --> 00:03:55,670
Head back to the editor.
62
00:03:55,670 --> 00:03:58,610
Pace the items into the content array.
63
00:04:00,800 --> 00:04:03,050
There are two items in the array.
64
00:04:03,080 --> 00:04:06,950
The first item is the index html file.
65
00:04:06,980 --> 00:04:09,080
The second item is a pattern.
66
00:04:09,110 --> 00:04:14,100
Tailwind will search for classes in all files in the source directory.
67
00:04:14,120 --> 00:04:17,910
If a file has the view or JavaScript extension.
68
00:04:17,930 --> 00:04:20,560
Tailwind will search through these files.
69
00:04:20,570 --> 00:04:22,010
That's all we'll need.
70
00:04:22,040 --> 00:04:24,780
Let's keep studying the other options.
71
00:04:24,800 --> 00:04:27,580
Afterward, we have the theme option.
72
00:04:27,590 --> 00:04:33,980
The theme option is where we can modify the colors, font sizes and other features of tailwind.
73
00:04:34,010 --> 00:04:36,850
Lastly, we have the plugins option.
74
00:04:36,860 --> 00:04:39,820
It's an array of plugins for extending tailwind.
75
00:04:39,830 --> 00:04:46,070
If we leave these options, empty tailwind will use its default configuration, which is suitable for
76
00:04:46,070 --> 00:04:47,150
most projects.
77
00:04:47,150 --> 00:04:50,680
Luckily, we will not need to customize tailwind.
78
00:04:50,690 --> 00:04:55,760
The default classes are suitable for our purposes as you'll soon see.
79
00:04:55,790 --> 00:04:59,300
Tailwind can account for almost any situation.
80
00:04:59,510 --> 00:05:01,970
There's one more thing I want to point out.
81
00:05:02,000 --> 00:05:04,450
You may receive an error from this file.
82
00:05:04,460 --> 00:05:07,640
The error stems from the module object.
83
00:05:07,670 --> 00:05:09,950
Technically this is not an error.
84
00:05:09,980 --> 00:05:13,180
Is lint is treating this object as an error.
85
00:05:13,190 --> 00:05:16,260
It doesn't know what the module object is.
86
00:05:16,280 --> 00:05:18,840
There are different ways to avoid this error.
87
00:05:18,860 --> 00:05:23,630
I think the simplest solution is to support Node as an environment.
88
00:05:23,660 --> 00:05:26,720
Open the s lint configuration file.
89
00:05:28,850 --> 00:05:33,140
At the bottom of the object at an object called environment.
90
00:05:35,220 --> 00:05:39,480
Next, add the node property with a value of true.
91
00:05:43,890 --> 00:05:48,300
The environment object will allow us to support different environments.
92
00:05:48,300 --> 00:05:52,650
Currently is lint assumes that our app is running in the browser.
93
00:05:52,680 --> 00:05:54,600
This is primarily true.
94
00:05:54,630 --> 00:06:00,740
However, we have a few files that run in Node to add support for node environments.
95
00:06:00,750 --> 00:06:03,030
We can set the node property to.
96
00:06:03,030 --> 00:06:03,690
True.
97
00:06:03,720 --> 00:06:09,300
You may need to restart the editor or close the file for these changes to take effect.
98
00:06:11,470 --> 00:06:12,180
Great.
99
00:06:12,190 --> 00:06:14,770
The error from is lint has gone away.
100
00:06:14,800 --> 00:06:16,690
We're almost at the finish line.
101
00:06:16,720 --> 00:06:26,260
The final step is to load tailwinds classes into our CSS files, open the base CSS file from the source
102
00:06:26,260 --> 00:06:28,300
slash assets directory.
103
00:06:30,490 --> 00:06:35,250
Initially view will create this file for creating base styles.
104
00:06:35,260 --> 00:06:37,980
It will be pre-filled with CSS code.
105
00:06:37,990 --> 00:06:40,390
Let's completely empty the file.
106
00:06:42,530 --> 00:06:50,480
Next, add three directives called base components and utilities with the Added Tailwind Directive.
107
00:06:55,800 --> 00:06:58,540
These directives are created by tailwinds.
108
00:06:58,560 --> 00:07:02,490
They'll inject tailwinds classes into our project.
109
00:07:02,520 --> 00:07:06,980
Tailwind classes aren't automatically injected into our project.
110
00:07:06,990 --> 00:07:10,250
We need to tell it where to load its styles.
111
00:07:10,260 --> 00:07:12,930
These directives will perform that action.
112
00:07:12,930 --> 00:07:14,550
There's one final step.
113
00:07:14,550 --> 00:07:17,310
The CSS file must be imported.
114
00:07:17,340 --> 00:07:19,740
Open the main JS file.
115
00:07:21,770 --> 00:07:26,130
We haven't had the opportunity to review this file in the future.
116
00:07:26,150 --> 00:07:28,470
I promise we'll talk about this file.
117
00:07:28,490 --> 00:07:35,150
For now, the main objective is to load our project CCIS below the import statements.
118
00:07:35,150 --> 00:07:38,360
Import the base case file.
119
00:07:40,520 --> 00:07:41,600
Just like that.
120
00:07:41,600 --> 00:07:43,520
We have installed Tailwind.
121
00:07:43,550 --> 00:07:46,640
It took a while, but it was well worth the effort.
122
00:07:46,670 --> 00:07:50,370
Tailwind is an extremely powerful CSS framework.
123
00:07:50,390 --> 00:07:53,870
Most of the template styles depend on this framework.
124
00:07:53,900 --> 00:07:58,040
In the next lecture, we're going to get some practice with Tailwind.
10843
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.