How can I add custom js file and compile using requirejs file in magento 2 ?
please give me details for this process.
How can I add custom js file and compile using requirejs file in magento 2 ? please give me details for this process. |
||||
|
Keep your js file inside You can add js using xml file with default.xml file,
Run command to get js at compile time, You can call js inside phtml file by calling,
Second way, create requirejs-config.js file, inside app/design/frontend/Vendor/themename/Vendor_Modulename/requirejs-config.js file add js file inside,
call inside template file,,
|
|||||
|
requiredjs with file name (../view/frontend/requirejs-config.js)
}; Add your js to ../view/frontend/web/js/.js
|
|||
|