|
153 | 153 |
|
154 | 154 | ## Optional configurations
|
155 | 155 |
|
| 156 | +### @source directive configuration (for Tailwind CSS v4) |
| 157 | + |
| 158 | +The `content` section from Tailwind CSS v3 has been replaced with the `@source` directive in Tailwind CSS v4. |
| 159 | +The `@source` directive is a new way to specify the source files that Tailwind CSS should scan for class names. It's |
| 160 | +placed in the `style.css` file. |
| 161 | +
|
| 162 | +By default, it looks like this: |
| 163 | +
|
| 164 | +```css |
| 165 | +@source "../../**/*.{html,py,js}"; |
| 166 | +``` |
| 167 | +
|
| 168 | +This means that Tailwind CSS will scan all HTML, Python, and JavaScript files in all directories starting from the |
| 169 | +three directories above the `style.css` file. Depending on your project structure, you might need to adjust the |
| 170 | +`@source` directive to suit your specific project layout. |
| 171 | +
|
| 172 | +For more information about setting `@source`, check out the *"Source Configuration"* page of the Tailwind CSS docs: |
| 173 | +[https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources](https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources). |
| 174 | +
|
156 | 175 | ### Content (formerly Purge) rules configuration (for Tailwind CSS v3)
|
157 | 176 |
|
158 | 177 | The `content` section of your `tailwind.config.js` file is where you configure the paths to all of your HTML templates,
|
@@ -187,25 +206,6 @@ HTML files (or files containing HTML content, such as `.vue` or `.jsx` files) ar
|
187 | 206 | For more information about setting `content`, check out the *"Content Configuration"* page of the Tailwind CSS
|
188 | 207 | docs: [https://tailwindcss.com/docs/content-configuration](https://tailwindcss.com/docs/content-configuration).
|
189 | 208 |
|
190 |
| -### @source directive configuration (for Tailwind CSS v4) |
191 |
| - |
192 |
| -The `content` section from Tailwind CSS v3 has been replaced with the `@source` directive in Tailwind CSS v4. |
193 |
| -The `@source` directive is a new way to specify the source files that Tailwind CSS should scan for class names. It's |
194 |
| -placed in the `style.css` file. |
195 |
| -
|
196 |
| -By default, it looks like this: |
197 |
| -
|
198 |
| -```css |
199 |
| -@source "../../**/*.{html,py,js}"; |
200 |
| -``` |
201 |
| -
|
202 |
| -This means that Tailwind CSS will scan all HTML, Python, and JavaScript files in all directories starting from the |
203 |
| -three directories above the `style.css` file. Depending on your project structure, you might need to adjust the |
204 |
| -`@source` directive to suit your specific project layout. |
205 |
| -
|
206 |
| -For more information about setting `@source`, check out the *"Source Configuration"* page of the Tailwind CSS docs: |
207 |
| -[https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources](https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources). |
208 |
| -
|
209 | 209 | ### Configuration of the path to the `npm` executable
|
210 | 210 |
|
211 | 211 | *Tailwind CSS* requires *Node.js* to be installed on your machine.
|
|
0 commit comments