Laravel Elixir Setup0:00
Welcome back. So in the last lesson we set up Babel and we talked about transformations and making this work in as many browsers as possible. But now, what would all this look like if you build a Laravel project? Okay, I'll show you the basic setup with Elixir, and I think you're gonna like it. So we could say, laravel new es6 project. And as you may know, if you use Laravel, we recommend you also use Laravel Elixir, which is sort of like a wrapper around Gulp to simplify all of these common tasks. So if I cat our package.json file, you'll see that we do have Laravel Elixir as a dependency. So let's go ahead and install all that. Okay, that's all set up. So now, if we take a look at this, within my gulpfile.js, I'm gonna say mix.browserify, and we'll reference a
Browserify and Compile ES60:40
ahead and install all that. Okay, that's all set up. So now, if we take a look at this, within my gulpfile.js, I'm gonna say mix.browserify, and we'll reference a main.js file. Now, if we try to run this, it's not going to work because we haven't created that file. So at the top, yeah, it can't find the file. So let's create it. Now, within there, I'm gonna create the exact same Person class that we had before. So constructor, name, assign the name, and let's keep it like that. That's fine. Now, if I compile this down, gulp, this will automatically take care of all the Babel compilation for you. So you didn't even need to think about that. If you now go to public/js/main.js, here is our transformed code that'll work in as many browsers as possible. So yeah, that's a nice perk. If you use Laravel,
Review Output and Next Steps1:23
If you now go to public, js, main.js, here is our transformed code that'll work in as many browsers as possible. So yeah, that's a nice perk. If you use Laravel, then consider using Laravel Elixir, and you don't even need to think about all that Babel stuff. It'll just work. Okay, in the very next lesson, we're gonna get started learning ES6.
