1

buddy: Now i'm contact the magento 2.0 vesion first time, before i contact the magento 1.0 vesion all the long time. Now i want to add a customer(customize) css file, and a customer(customize) JS file, But i don't konw how to do it? I have to via the google to found the Tutorial, but i couldn't found the good idea! So i need your help from the stackoverflow! In magento1.0 version, i via found the app/layout/page.xml file, to add the customer CSS file, such as: css/mystyles.css
But i don't know how to add customer css file in magento 2.0 vesion? Thanks very much!

nextion
  • 133
  • 1
  • 10

1 Answers1

3

1.Make an entry in below xml

app/code/My_company/ModelName/view/adminhtml/layout/default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <head>
     <link src="My_company_ModuleName::js/custom.js"/>
     <css src="My_company_ModuleName::css/custom.css" />
   </head>
   <body>

2. Create custom js and css file in belows path.

app/code/My_company/ModelName/view/adminhtml/web/js/custom.js

app/code/My_company/ModelName/view/adminhtml/web/css/custom.css
Pramod Kharade
  • 2,832
  • 1
  • 23
  • 39