0

I'm developing very small modules and would like to put all javascript 3rd party libraries in one place to better maintain/update them and to avoid duplicating across modules. According to the documentation,"Do not put custom JS files in the lib/web directory". So the best place is to place them in _core/view/frontend/web/js module ? Make module dependency to it and map js libraries in each others with requirejs-config.js ? Or am I misunderstanding the magento doc ?

I don't think it is a good idea to place them in my theme as it is not theme related.

  • typo I mean **myvendor_core**/view/frontend/web/js – Laor Mar 30 '17 at 10:16
0

The usual solution I saw is to create "base" module and put such elements there. So if you create Vendor_Base and dependency in etc/modules.xml and etc/composer.json in child modules. If you want to deliver modules each one need to be bundled with this Vendor_Base. Custom js put in Vendor/Base/view/frontened/web/js and create Vendor/Base/view/frontend/require.js file to give them better name to use in child modules js files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.