I am making a custom gallery module using Light Gallery. In most cases, I would just place all my JS files inside /assets/js directory. But I wonder if this is good practice when using an external GPLv3 resource?

Maybe a lib directory would be more appropriate? Personally I prefer to just keep it inside the assets directory. It's unclear to me which directory to use and why? Any insights on this? What is best practice?

PS: Module ships with both minified an unminified JS files, copyright notice remains intact offcourse.


If the external resource is just 1 file (even if it has a minified version with it), I would place it directly in the /assets/js directory. If the resource is a collection of 2 or more files, I would give it a subdirectory within the /assets/js directory.

This is just personal opinion since in many years of joomla experience I've never come across definitive guidelines for this. 3rd party extensions seem to be all over the place with their file organization. I'd leave it as a comment, but I'm new here and cannot.

  • Welcome to JSE, Ricky. Please take our tour and consider telling us a little about yourself and your Joomla journey by editing your profile. Thanks for contributing. – mickmackusa Jun 23 '20 at 5:11

If you want to distribute your module so that other people can use it, then you should keep flexibility in mind. In that case the best practice would be to put images, script and CSS style sheets in their own extension folder in Joomla's /media/mod_yourmodule/js/. The media folder is used for files that are served by components, modules and plugins and can be overridden with template overrides.

If the module is just for your own website, then I would do the same as Ricky Goldman recommends and add it to an /assets/js/ folder in your module.

If I would want to use GPL PHP scripts from external sources (e.g. from packagist.org), then I would use composer to add it to a /vendor/ folder in my own extension.

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.