Adding my custom javascript to the page

  • Hi
    In case of attachingcustom stylesheet to the active theme we know that we should use something like this:

    Event::listen('bagisto.admin.layout.head', function($viewRenderEventManager) {

    But how about a custom js? Suppose that I have a javascript file. I know that there is a event in the system named that we can write a listener for it and attach our javascript to the page. but how we can do this?

  • Thank you but that article is about registering css files but I want to attach a javascript. For example I want to attach the resides in /packages/CompanyName/ProjectName/src/Resources/assets/js/app.js to the page. Now what code I should write in the placeholder?

    Event::listen('', function($viewRenderEventManager) {
                /** PlaceHolder: What code I should write here? **/

  • Hi, @manatech

    for the js you just need to add you js into master.blade.php

        <script type="text/javascript" src="{{ bagisto_asset('your js path') }}"></script>

Log in to reply