Initializing and locating JavaScript component

With the portability provided by RequireJS, you can specify JavaScript resources used in your modules and themes. The scope of action, as well as the basic structure of directories can be defined in:

  • Library: JavaScript libraries used for application of libraries and archives in several modules and themes, aiming at the reuse in themes projects. Addresses the use in the lib/web directory.
  • Module: Application of libraries and files with the reduced scope, acting only in the module. Addresses its use in the <module_dir>/view/<areaname>/web.
  • Theme: Application of libraries and archives with reduced scope, acting only in the theme. Addresses its use in the directory <theme_dir>/<VendorName>_<ModuleName>/web ...

Get Magento 2 Theme Design - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.