6

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.

9

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

| improve this answer | |
  • it work. And I'm try <script type="text/javascript" src="Xanka_Slider::js/slider/jquery.themepunch.plugins.min.js"/> . it ok. thank you. – xanka Oct 13 '15 at 7:33
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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