assely / framework

Assely is a PHP framework which brings a little joy to the WordPress development. Develop structured, easily scalable and complex WordPress websites and web applications with true pleasure.
MIT License
57 stars 7 forks source link

Adapt Laravel Mix #42

Open jedrzejchalubek opened 7 years ago

jedrzejchalubek commented 7 years ago

Move to Laravel Mix instead of Elixir.

marcwieland95 commented 7 years ago

Nice. Browsersync seem to work a little different than in Elixir. Keep an eye on this.

jedrzejchalubek commented 7 years ago

Roughly done on assely/assely/tree/laravel-mix and assely/framework/tree/laravel-mix branches.

Can be tested.

marcwieland95 commented 7 years ago

Great, will do tomorrow evening

marcwieland95 commented 7 years ago

ok, I get it to work really quick. Hot Reloading doesn't work at the time (it's a general problem - (https://github.com/JeffreyWay/laravel-mix/issues/233)). I think Jeffrey will add BrowserSync support soon. In the meantime, I get it to work with this article (https://ashokgelal.com/2017/01/29/laravel-mix-browsersync/).

How should the mix() helper function work? Like in Laravel <link rel="stylesheet" href="{{ mix('/css/app.css') }}"> or inside the Asset class.

jedrzejchalubek commented 7 years ago

Oh, good to know. I'll wait with merging.

It should be used inside Http/assets.php when defining assets. Helper functions are namespaced in Assely for safety reasons, so there need to be imported. Something like this:

use function Assely\Helpers\mix;

Asset::add('app', ['path' => mix('css/app.css')]);

I haven't tested it out yet.

marcwieland95 commented 7 years ago

Yes, that's a good decision. Laravel Mix in general is not ready at the time. It works, but is not ready for production in my opinion.

I tested the enqueuing of media files. After my adjustment (https://github.com/assely/framework/pull/53) everything works fine.

The helper function (mix()) could be merged into the master branch, because Laravel Elixir would also profit from it.