Adding Javascript Resources in Laravel (AJRL)

How to Insert Custom JS in app.js
Hi dev, actually this is a basic question, I am a beginner in using this laravel framework, and while diving into this laravel framework there is one thing that makes me curious, namely how complex it is to embed javascript resources in this framework.

Let's say I have a resource /resources/js/plugins which contains a javascript file, then how do I include that bundle in app.js?

Solution

So, I use laravel mix to compile all my multiple assets into 1 app.js file by modifying the webpack.mix.js file configuration... it will look something like this,

mix.scripts([
   'resources/assets/js/vendor/selectize.js',
   'node_modules/pikaday/pikaday.js',
   'resources/assets/js/admin.js'
], 'public/js/admin.js')

For a more complete discussion of mix js, please visit the official Laravel documentation,  HERE .


Post a Comment

Previous Next

نموذج الاتصال