Back to all docs

Laravel Mix

Laravel Mix

Introduction

[!WARNING] Laravel Mix is a legacy package that is no longer actively maintained. Vite may be used as a modern alternative.

Laravel Mix, a package developed by Laracasts creator Jeffrey Way, provides a fluent API for defining webpack build steps for your Laravel application using several common CSS and JavaScript pre-processors.

In other words, Mix makes it a cinch to compile and minify your application’s CSS and JavaScript files. Through simple method chaining, you can fluently define your asset pipeline. For example:

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css');

If you’ve ever been confused and overwhelmed about getting started with webpack and asset compilation, you will love Laravel Mix. However, you are not required to use it while developing your application; you are free to use any asset pipeline tool you wish, or even none at all.

[!NOTE] Vite has replaced Laravel Mix in new Laravel installations. For Mix documentation, please visit the official Laravel Mix website. If you would like to switch to Vite, please see our Vite migration guide.

More Documentation

- ## Prologue AI Assisted Development Artisan Console Asset Bundling (Vite) Authentication Authorization Blade Templates Broadcasting Cache Collections Concurrency Configuration Console Tests Context Contracts Contribution Guide Controllers CSRF Protection Database Testing Database: Getting Started Database: Migrations Database: Pagination Database: Query Builder Database: Seeding Deployment Directory Structure Eloquent: API Resources Eloquent: Collections Eloquent: Factories Eloquent: Getting Started Eloquent: Mutators & Casting Eloquent: Relationships Eloquent: Serialization Email Verification Encryption Error Handling Events Facades File Storage Frontend Hashing Helpers HTTP Client HTTP Requests HTTP Responses HTTP Session HTTP Tests Installation Laravel AI SDK Laravel Boost Laravel Cashier (Paddle) Laravel Cashier (Stripe) Laravel Dusk Laravel Envoy Laravel Folio Laravel Fortify Laravel Homestead Laravel Horizon Laravel MCP Laravel Octane Laravel Passport Laravel Pennant Laravel Pint Laravel Pulse Laravel Reverb Laravel Sail Laravel Sanctum Laravel Scout Laravel Socialite Laravel Telescope Laravel Valet Localization Logging Mail Middleware Mocking MongoDB Notifications Package Development Precognition Processes Prompts Queues Rate Limiting Redis Release Notes Request Lifecycle Resetting Passwords Routing Search Service Container Service Providers Starter Kits Strings Task Scheduling Testing: Getting Started The MIT License (MIT) Upgrade Guide URL Generation Validation Views