JavaScript

JavaScript

by Inês de Sousa Lopes -
Number of replies: 3

Hello!

I wanted to add a javascript file on my block. I saw on several Moodle plugins that the javascript files are on a "amd" folder with a "build" and "src" folder inside. Those folders are necessary to add js files? Why do they exist? 


Thank you!

Average of ratings: -
In reply to Inês de Sousa Lopes

Re: JavaScript

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, it is the recommended way to do JS in Moodle. https://docs.moodle.org/dev/Javascript_Modules (Ensures the code is minified before served, handles dependencies between different bits of JS, ensures it is served with good caching headers, etc.)