Skip to content

Commit a672461

Browse files
AshboDevjessarcher
andauthored
fix: compile error following upgrade.md's vite to mix guide (#231)
* Update UPGRADE.md Include fix for postcss.config.js when compiling assets * Change code block to diff * Add note to remove type from package.json * Formatting changes to step headings * Update UPGRADE.md --------- Co-authored-by: Jess Archer <[email protected]>
1 parent 5da1259 commit a672461

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

UPGRADE.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Then you will need to specify the base URL for assets in your application's entr
271271

272272
### Optional: Configure Tailwind
273273

274-
If you are using Tailwind, perhaps with one of Laravel's starter kits, you will need migrate your `tailwind.config.js` to use [Vite compatible imports](#vite-compatible-imports) and exports.
274+
If you are using Tailwind, perhaps with one of Laravel's starter kits, you will need to migrate your `tailwind.config.js` configuration file to use [Vite compatible imports](#vite-compatible-imports) and exports:
275275

276276
```diff
277277
- const defaultTheme = require('tailwindcss/defaultTheme');
@@ -459,6 +459,12 @@ Update your NPM scripts in `package.json`:
459459
}
460460
```
461461

462+
You should also remove the `type` key by running the following command:
463+
464+
```shell
465+
npm pkg delete type
466+
```
467+
462468
#### Inertia
463469

464470
Vite requires a helper function to import page components which is not required with Laravel Mix. You can remove this as follows:
@@ -538,3 +544,55 @@ You may also wish to remove any `.gitignore` paths you are no longer using:
538544
- /bootstrap/ssr
539545
- /public/build
540546
```
547+
548+
### Optional: Configure Tailwind
549+
550+
If you are using Tailwind, perhaps with one of Laravel's starter kits, you will need to update your `tailwind.config.js` configuration file to use CommonJS imports and exports:
551+
552+
```diff
553+
- import defaultTheme from 'tailwindcss/defaultTheme';
554+
- import forms from '@tailwindcss/forms';
555+
+ const defaultTheme = require('tailwindcss/defaultTheme');
556+
557+
- export default {
558+
+ module.exports = {
559+
content: [
560+
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
561+
'./storage/framework/views/*.php',
562+
'./resources/views/**/*.blade.php',
563+
'./resources/js/**/*.vue',
564+
],
565+
566+
theme: {
567+
extend: {
568+
fontFamily: {
569+
sans: ['Figtree', ...defaultTheme.fontFamily.sans],
570+
},
571+
},
572+
},
573+
574+
- plugins: [forms],
575+
+ plugins: [require('@tailwindcss/forms')],
576+
};
577+
```
578+
579+
You may also migrate any PostCSS plugins from your `postcss.config.js` file to your `webpack.mix.js` file:
580+
581+
```diff
582+
mix.js('resources/js/app.js', 'public/js')
583+
.postCss('resources/css/app.css', 'public/css', [
584+
- //
585+
+ require("tailwindcss"),
586+
]);
587+
```
588+
589+
> **Note**
590+
> You do not need to include the `autoprefixer` plugin as Laravel Mix includes this by default.
591+
592+
If you are using other PostCSS plugins, such as `postcss-import`, you will need to include them in your configuration. See the [Laravel Mix PostCSS documentation](https://laravel-mix.com/docs/6.0/postcss) for more information.
593+
594+
Finally, you may also remove your PostCSS config file:
595+
596+
```shell
597+
rm postcss.config.js
598+
```

0 commit comments

Comments
 (0)