1

enter image description here

Please help me how can i add my custom abc.css and filename.js in magento 2.2.2 .

default_header_html.xml file path

app/design/frontend/custom-theme/my-first-theme/Magento_Theme/layout/default_header_html.xml

my css path

app/design/frontend/custom-theme/my-first-theme/web/css/source/abc.css

my js path

app/design/frontend/custom-theme/my-first-theme/web/js/filename.js
0

enter image description hereapp/design/frontend/vendorname/theme/web/css/custom.css

app/design/frontend/vendorname/theme/Magento_Theme/layout/default_head_blocks.xml

<css src="css/custom.css" order="100"/>

<script src="js/custom.js"/>
1
  • Hi saphal jha thanks for gave answer but in above code not working..my xml file path is : app/design/fronted/custom-theme/my-first-theme/Magento_Theme/layout/default_head_block.xml. my css path is app/design/fronted/custom-theme/my-first-theme/web/css/custom.css Jan 29 '18 at 9:54
0

Kindly use below code

<css src="Magento_Theme::css/custom.css" />
<link src="Magento_Theme::js/custom.js"/>

Js File Path:

app\design\frontend\PackageName\ThemeName\Magento_Theme\web\js\custom.js

Css File Path:

app\design\frontend\PackageName\ThemeName\Magento_Theme\web\css\custom.css
4
  • Hi Nilesh Gosai thanks for gave answer but in above code not working.. Jan 29 '18 at 9:45
  • Have you cleared cache and deploy static content? if not then run below commands php bin/magento setup:upgrade php bin/magento setup:static-content:deploy Jan 29 '18 at 9:46
  • Hi gosai thanks for gave answer but in above code not working..my xml file path is : app/design/fronted/custom-theme/my-first-theme/Magento_Theme‌​/layout/default_head‌​_block.xml. my css path is app/design/fronted/custom-theme/my-first-theme/web/css/custo‌​m.css Jan 29 '18 at 9:56
  • Your css path is incorrect check my answer Jan 29 '18 at 10:01

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.