Skip to content

Laravel Mix

tanthammar edited this page Dec 29, 2020 · 9 revisions

CSS (Laravel 8)

Add support for nested css

You must add support for nested css, if you used the Artisan command to install Tall-forms, or if you installed the custom.css Otherwise, you won't be able to compile your css.

npm install postcss-import autoprefixer@9 postcss-nesting alpinejs --save-dev

or if you are using PostCSS 8

npm install postcss@latest autoprefixer@latest postcss-nesting alpinejs --save-dev

webpack.mix.js for Laravel 8 (css)

const mix = require('laravel-mix');
const cssNesting = require('postcss-nesting'); //<-- ADD THIS -->

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [
        require('postcss-import'),
        cssNesting(), //<-- AND THIS -->
        require('tailwindcss'),
        require('autoprefixer') //if you're on tailwind 2
    .webpackConfig(require('./webpack.config')); //if you're on Jetstream v1.x

Sass (Laravel 7)

webpack.mix.js for Laravel 7 (sass)

const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .options({
        processCssUrls: false,
        postCss: [ tailwindcss('./tailwind.config.js') ],
    });

If you want to use Laravel Mix 6

see Laravel Mix 6 + TW2 Upgrade.

Next step -> install the theme

Clone this wiki locally