Hi, I'd like to add a .js to the Flix-template. It's easy enough to store it in templates/ja_flix/js but how to I call for it, to make it work? It's supposed to end up in the <head>, right?

    meseko

    Step 1/ Add your js file here: \templates\ja_flix\js

    Step 2/ Open the templates\ja_flix\etc\global.json file, and add "your-js-name" to this file,
    NOTE: The "your-js-name" will be use in the assets.json file (step3)

    {
      "system_optimizecss": "1",
      "system_optimizecss_exclude": null,
      "system_optimizejs": "1",
      "system_optimizejs_exclude": null,
      "system_advancedCodeAfterHead": null,
      "system_advancedCodeBeforeHead": null,
      "system_advancedCodeAfterBody": null,
      "system_advancedCodeBeforeBody": null,
      "system_addons": [
        "font.awesome4",
        "font.awesome5",
        "font.iconmoon",
        "jomsocial",
        "owl.carousel",
        "font.ionicons",
        "your-js-name"
      ]
    }

    Step 3/ Open the templates\ja_flix\etc\assets.json file and override this code to your file:

    {
      "name": "Local Assets",
      "assets": {
        "jomsocial": {
          "name": "jomsocial",
          "css": [
            "css\/jomsocial.css"
          ]
        },
        "owl.carousel": {
          "name": "owl.carousel",
          "css": [
            "js\/owl-carousel\/owl.carousel.min.css"
          ],
          "js": [
            "js\/owl-carousel\/owl.carousel.min.js"
          ]
        },
        "font.ionicons": {
          "name": "font.ionicons",
          "css": [
            "fonts\/ionicons\/css\/ionicons.min.css"
          ]
        },
        "your-js-name": {
          "name": "your-js-name",
          "css": [
            "js\/js-folder\/js-library-file.min.css"
          ],
          "js": [
            "js\/js-folder\/js-library-file.min.js"
          ]
        }
      }
    }

    NOTE: Find the following code to change with your custom js:

        "your-js-name": {
          "name": "your-js-name",
          "css": [
            "js\/js-folder\/js-library-file.min.css"
          ],
          "js": [
            "js\/js-folder\/js-library-file.min.js"
          ]
        }

    Step 4: Enable the js here:

    Hello.
    That seemed fine and I can activate the .js among the addons BUT shouldn't it be visible in the <head> section like the others?

      Hi meseko,
      I have tested on our dev site and the js files will be visible in the <head> section. Could you let me know the js file that you added?

        6 days later

        Okay, I think we can close this one... although it was useful information. I open another ticket if the need arises again.

        Write a Reply...
        You need to Login to view replies.