-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel Mix #1868
Comments
Laravel Mix is very new, and Sage 9 is already in Beta. The beta phase is generally for bug fixes after all features have been implemented. To rewrite Sage 9 to be built off of Mix at this point in the game would not make sense IMO, especially when there is nothing wrong with Sage 9 as it stands. What does Mix have to offer that Sage doesn't that is worth taking Sage 9 development back to Alpha? To me a fluent API for people who don't understand webpack is not worth killing what the Sage developers have worked so hard for, especially when it works beautifully. Many people, myself and company included, are anticipating the release of Sage 9 in the near future. Porting everything over to Mix just doesn't make sense to me. While I'm a huge Laravel fan I do not think that it makes sense to drastically change Sage 9 for the sake of a shiny new package when Sage is so close to being ready. |
I wouldn't entirely say it'd bring Sage 9 back to alpha by any means. Implementation of Laravel Mix is quite easy.
Here's a config I made in 5 minutes that compiles Stylus and adds two postCss packages. I guess the main things it offers is easier configuration for projects using Vue and Stylus over jQuery and SASS. It also has better error reporting, cleaner notifications on successful builds, vastly less devDependencies for Sage it's self, and the ability to omit the assets/build folder entirely. Here's the required devDependencies using Mix:
For what it's worth though, my config above is not yet PERFECT for implementation into Sage. But it's "working" albeit a bit dirty. Also worth nothing that my Stylus example above is a bit more than most would need. Here's an example of a Mix that is comparable to the configuration that currently ships with Sage 9:
Remaining fixes would include:
|
"vastly less devDependencies for Sage it's self" isn't really a good argument, considering this is the hard dependencies list for Mix:
This means Sage has to trust Mix to use the proper versions of these packages and keep everything up-to-date. While historically Jeffrey Way and the Laravel ecosystem have a great track record of doing so, the more abstracted Sage becomes from the libraries it uses the more likely you are to get into a dependency hell, especially in the NPM ecosystem (from my experience). It also means that Sage's docs will have a link that says "go read Laravel Mix's documentation for how to configure half of our theme". Just doesn't seem right to me. As a developer who's thinking of trying Sage for the first time, if I went to Sage's website (without knowing Laravel) I'd think "Oh great, another thing to learn". Let's not forget that Elixir, the predecessor to Mix, was around for a short amount of time before being ditched for Mix. I like the idea of using Mix, but I think for Sage 9 it isn't ready yet. We're so eager to use the shiniest new thing, but why not wait until Sage 10 is being thought about a year or two from now and see if Mix is even still a thing? The only convincing argument I'm seeing is errors and build output, which I agree could be much better in Sage 9. Why don't we work on that instead of just implementing something entirely different? |
Lavarel Mix has nothing to do with Sage, i guess. If you really want it, just make your own fork and use lavarel mix and everything you need. For example, i moved all the webpack/rollup files into a module and use it with extra options and etc Migrate-build-files |
It looks like with the directory rebasing that was pushed by retlehs that this may be full circle pretty fast. I'm guessing the plan is going to be to separate Sage 9s build scripts into their own repo and then allow the user to choose between them and Mix. Mix as of now has full support with the new sage 9 directory structure. Main thing I need to add is image minification and a mix.copy. I'll continue playing with this all when I get up tomorrow. |
Long-time user, first-time commenter. I think laravel mix is already pretty reliable and straight-forward. It's a light layer over Webpack. Frankly, in the past Sage's build processes (whether the lest-than-speedy gulp builds of the past or the more modern varieties), have felt a bit slow and clunky. I think the root's team's time could be better spent on other things and abstracting the build process to mix seems like a great idea. It also depends on the trajectory of the project. If the theme is about bringing together that great controller class, blade templates, and other external libs under a clean, well-organized theme structure, than switching to mix makes quite a bit of sense to me. |
Mix please. |
I'm using mix on a Laravel project I just joined, and the Laravel mix wrapper over webpack is still using a beta version of webpack (2.2.0-beta28 IIRC). Webpack is at like 2.5.0+ currently, so unless you like being locked in to old versions of your dependencies, I would not recommend switching to Mix. Long-term, we'll almost certainly be dropping mix in favor of using webpack directly. |
Are you sure? 😄 At the opposite, I think using mix will simplify the non-php-dependencies management for Sage. |
@LeoColomb That's fairly recent, it's locking to the 2.3.0 series instead of 2.50 (where they're at now) and it still highlights the type of issue you're going to run into depending upon a wrapper over webpack and other libraries instead of those libraries themselves. |
Another reason to use mix that is appealing, to me at least, is that mix supports the vue loader out of the box, which is a bit of a headache to setup otherwise. |
Mix is now past 1.0 and uses Webpack 3 as well. I think the argument "go read Laravel Mix's documentation for how to configure half of our theme" doesn't really hold ground when Blade is already used so that's already the case anyway. |
I've been using Laravel Mix in place of Sage's default Webpack setup for the last couple projects and haven't had any issues whatsoever. Here is my current
The above configuration is being used with Stylus instead of Sass, but is very easily interchangeable. (i.e. simply change To make
I haven't experienced any of the issues reported with Sage's default Webpack setup using this Mix configuration. BrowserSync, reloading, injecting, etc. all works perfectly. Here's an example of my
My |
What are exactly the bonus points in using Laravel Mix instead of webpack in the sage scenario where all the build scripts are already written? |
laravel mix is still webpack |
Updated my post above to use the latest dependencies and the new Laravel Mix syntax. |
Maybe this can exist as a custom config in the docs. |
We can probably make room for this in https://github.com/roots/sage-installer Feel free to start an issue there to discuss this further. To be clear, sage-installer is a dependency of sage (see my latest PR). It runs automatically when you use |
Doesn't make sense to maintain a separate build tool with Sage. +1 for Laravel Mix |
Submit a feature request or bug report
Feature Request
There has been a good amount of chatter behind the scenes on if Sage 9 should move to Laravel Mix.
I've heard it has its fair share of issues but most seem to be getting patched as they arise. Jeffery Way who built Laravel Mix has an incredible reputation and Mix once all the remaining bugs are kinked out will be quite awesome.
It allows the use of stylus, sass, less, vue, and more out of the box with ridiculously easy configuration.
I'd love some community and developer feedback on this. If it gains traction but none of the developers have the time to work on it, I'd be willing to work on it in a PR as well as update the Sage 9 docs.
Main things to take into consideration is doing an initial mix configuration that allows us to remap all the directories, and extend various plugins/modules like
purifyCss
to work in Sage's environment.And of course, customizing the notification icon to show a roots icon instead. :)
The text was updated successfully, but these errors were encountered: