Fresh install Laravel >= 7.0 and cd
to your app.
Install this preset via composer require cnzaicom/tailwindcss --dev
. Laravel will automatically discover this package. No need to register the service provider.
Edit tailwindcss.config.js to add plugins: [ require('@tailwindcss/forms'), require('@tailwindcss/typography'), require('tailwindcss-children'), ]
Edit webpack.mix.js like this
mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', [
require('tailwindcss'),
/*自动增加 CSS 前缀词*/
require("autoprefixer"),
/*在 CSS 用嵌套的写法*/
require('postcss-nested'),
/*在 CSS 里可以 import 其他 CSS*/
require('postcss-import'),
]);
Use php artisan ui tailwindcss
for the basic Tailwind CSS preset
npm install && npm run dev
php artisan serve
(or equivalent) to run server and test preset.
php artisan ui tailwindcss --auth
for the basic preset, auth route entry, and Tailwind CSS auth views in one go. (NOTE: If you run this command several times, be sure to clean up the duplicate Auth entries in routes/web.php
)npm install && npm run dev
php artisan migrate
to create basic user tables.php artisan serve
(or equivalent) to run server and test preset.