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
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
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
-
Nice, @Pradeep it works, for my added new custom module, but how could I add script or css on Home Page? Any idea.Amit Dwivedi– Amit Dwivedi2016年02月16日 10:22:25 +00:00Commented Feb 16, 2016 at 10:22
-
in you theme in Magento_Theme/layout you can do itPradeep Kumar– Pradeep Kumar2016年02月16日 12:06:31 +00:00Commented Feb 16, 2016 at 12:06
Explore related questions
See similar questions with these tags.