Gabriel social Gabriel social -4 years ago 157
Javascript Question

How to import css, js using laravel-webpack from a new package installed by composer?

I'm installing this phackage:

So I was successful in composer php and now I can run it.
But I can see a lot of errors because I'm using laravel 5.4 with webpack 2 and I need to import theses css and js.
I'm wondering if I really need to import one by one like:
mix.js('resources/assets/js/app.js', 'public/js')

or can I use a better way. Maybe a autoload of all the css and js from a composer package.

Thank you guy for help a backend with frontend.

Answer Source

you need to add js and css file path into laravel Mix mix.js('resources/assets/js/app.js', 'public/js')

Or You can create a post-update command in composer.json like

"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
"php artisan asset:publish vendor/package"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download