Back Button Vue

Learn Laravel Mix

Webpack is the most powerful and flexible asset compilation tool available today. With that power, however, comes a certain level of complexity. That's where Laravel Mix steps in. Intended for the 80% usecase, Mix wraps around webpack to make most commonly desired build tasks a cinch to activate.

In this series, as the maintainer of Laravel Mix, I'll teach you everything you need to know - from the basics, to advanced configuration.

11 episodes
1:25:47 hrs
Start Series
  • Latest Episode: Build and Deploy a Mix Extension in 15 Minutes

  • Like this series? Share the love!

    1. Run Time 7:28 Free

      Let's begin by installing the necessary dependencies, and compiling our JavaScript and Sass as quickly as possible, using Mix. It's easy!

    2. Out of the box, you'll notice that Laravel includes a number of helpful NPM scripts for triggering webpack. To start, the most relevant ones are dev, watch, and prod. In this lesson, we'll decode these commands to ensure that you fully understand exactly what you're triggering.

    3. Run Time 12:46

      The mix.js() command is your go-to method for any JavaScript bundling needs. This will take care of ES2017 compilation, tree shaking, minification, and more. Let's review everything you need to know in this episode.

    4. Now that you understand how to compile your fancy, modern JavaScript, let's move on to CSS tooling. Whether you prefer Sass, Less, Stylus, or PostCSS, Mix has you covered.

    5. PostCSS may be used standalone, or even as a secondary step after your core Sass/Less compilation. Either way, the end result will be the same. Think of PostCSS plugins as layers of an onion, so to speak. Each layer has the chance to operate upon your stylesheet, and modify it in some way. Once complete, those styles are then passed on to the next layer of the onion. Let's review this workflow, when using Laravel Mix.

    6. Mix provides out-of-the-box support for Browsersync, which allows us to detect and refresh the browser each time a relevant asset of yours has changed. No longer will you have to manually refresh the browser over and over to review small, visual tweaks.

    7. The `mix.version()` call will append a unique hash to each file within your generated `mix-manifest.json` file. This can be used to instruct your server when to "bust the cache," and fetch a new copy of the related asset.

    8. Behind the scenes, Laravel Mix leverages Babel's env preset, when transforming your code. However, from time to time, you may need to register additional plugins. Let's review exactly how to do so in this episode.

    9. Laravel Mix 1.7 and higher ships with async/await support out of the box. These two keywords simplify the process of working with promises in a more synchronous fashion.

    10. Run Time 7:36 Free

      Laravel Mix 2.1 and up includes support for custom user extensions. In fact, the very components that Mix uses behind the scenes are constructed in the exact same way. In this episode, we'll learn the basics of the API. You'll see that there are two ways, based on the complexity of your new component, to extend Mix.

    11. Now that you understand the basic API for constructing Mix extensions, let's build and deploy a real-life extension through npm fifteen minutes!

You May Also Enjoy...

Here are some additional series that may be up your alley.

Vue Webpack for Everyone

Webpack is a wonderful tool for bundling front-end assets. Having said that, it can sometimes be a bit confusing to newcomers who switch over from a m...

1:19:20 hrs