{"id":1002,"date":"2020-05-15T06:40:09","date_gmt":"2020-05-15T06:40:09","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2020\/05\/15\/add-custom-css-and-js-in-magento\/"},"modified":"2025-05-22T13:04:54","modified_gmt":"2025-05-22T07:34:54","slug":"add-custom-css-and-js-in-magento","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/add-custom-css-and-js-in-magento\/","title":{"rendered":"How To Add Custom CSS and JS in Magento"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Earlier, I posted a solution to&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/add-custom-css-and-js-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">add custom CSS and JS in Magento 2<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The below post offers the same solution for Magento 1 store owners.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One can use the below code to&nbsp;<em><strong>add custom CSS and JS in Magento<\/strong><\/em>&nbsp;store in order to customize a custom theme or a page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019d recommend bookmarking this post for the next time you face a crazy client requirement!&nbsp; <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to add custom CSS and JS in Magento:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create&nbsp;<em><strong>app\/design\/frontend\/base\/default\/layout\/extension.xml<\/strong><\/em>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;layout version=\"0.1.0\">\n    &lt;default>\n        &lt;reference name=\"head\">\n            &lt;action  method=\"addItem\">\n                &lt;type>js&lt;\/type>\n                &lt;name>extension.js&lt;\/name>\n            &lt;\/action>\n            &lt;action method=\"addItem\">\n                &lt;type>skin_css&lt;\/type>\n                &lt;name>extension.css&lt;\/name>\n            &lt;\/action>\n        &lt;\/reference>\n    &lt;\/default>\n&lt;\/layout><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the solution with fellow Magento developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Also Read:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/meetanshi.com\/blog\/enable-merge-css-javascript-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Enable Merge CSS, Javascript in Magento 2<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Earlier, I posted a solution to&nbsp;add custom CSS and JS in Magento 2. The below post offers the same solution for Magento 1 store owners&#8230;.<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1002","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1002"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1002\/revisions"}],"predecessor-version":[{"id":16897,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1002\/revisions\/16897"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}