cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 : What is the best way to add Custom JS and CSS files?

Magento 2 : What is the best way to add Custom JS and CSS files?

How can we add custom JS file and to Magento 1 & 2 application globally or on the specific pages i.e Product page or Checkout page?

 

Can someone help with examples?

 

Thanks

2 REPLIES 2

Re: Magento 2 : What is the best way to add Custom JS and CSS files?

Hi @babarshinec7b6 

 

Following i am sharing the devdocs and other links which helps you to add custom css and js file on a global level and for specific page as well.

 

Magento DevDocs - https://devdocs.magento.com/videos/fundamentals/add-a-javascript-module/

 

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-topics/css-themes.html

 

To add globally follow the following link : 

 

https://webkul.com/blog/magento2-how-to-add-css-and-js-file-in-module/ 

https://code.vky.co.in/magento-2-custom-css-custom-js-custom-module/ 

 

To add on the specific page follow the following link : 

 

https://magento.stackexchange.com/questions/114327/magento-2-how-to-include-js-on-the-product-page 

 

Hope it helps !

 

 

if issue solved,Click Kudos & Accept as Solution

Re: Magento 2 : What is the best way to add Custom JS and CSS files?

hi I having an issue when reloading the Magento 2 admin page it is redirecting me to the login page every time I reload the page