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.

FireBear
2,1201 gold badge17 silver badges27 bronze badges
asked Oct 13, 2015 at 7:03

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

answered Oct 13, 2015 at 7:27
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

answered Oct 13, 2015 at 7:37
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.