7

I have custom module. I want add file my.js in folder app\code\Xanka\Slider\view\frontend\web\js\slider\my.js. I used code in app\code\Xanka\Slider\view\frontend\layout\default.xml

<head>
    <title>My Slideshow</title> 
    <script src="Xanka_Slider::js/slider/jquery.themepunch.plugins.min.js"/>        
</head>

is not true.

2 Answers 2

12

if want to add js file then try this

 <head>
        <link src="Xanka_Slider::js/slider/jquery.themepunch.plugins.min.js"/>
    </head>

Here instead of use using

0
4

use below code in

view\frontend\layout\test_index_index.xml

<head>
    <title>My Slideshow</title> 
   <link src="Xanka_Slider::js/slider/jquery.themepunch.plugins.min.js"/>               
</head>

and then keep you js file in below path

pub/static/frontend/Magento/luma/en_US/Xanka_Slider/js/slider/jquery.themepunch.plugins.min.js

2
  • Nice, @Pradeep it works, for my added new custom module, but how could I add script or css on Home Page? Any idea. Commented Feb 16, 2016 at 10:22
  • in you theme in Magento_Theme/layout you can do it Commented Feb 16, 2016 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.