numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
200 stars 118 forks source link

Add support for standalone_scripts folder in extensions. #863

Closed jhoobergs closed 2 years ago

jhoobergs commented 2 years ago

Sometimes it is useful to have js files in extensions that are not added to the script.js file. One example is when you use WebWorkers and they need to run a specific js file as used in my new extension https://github.com/jhoobergs/numbas-extension-sqlite/

christianp commented 2 years ago

This is a good idea, thanks! I'm not completely sure if the check you've got is robust - I'd prefer it to be a bit more explicit about how the paths should look. I'll come back to this later, hopefully this week.

jhoobergs commented 2 years ago

Yeah, I actually wanted to check whether the last parts were right, but apparently I checked the first parts.

You will probably know a better way to do the check.

christianp commented 2 years ago

I've made it so that any path with a directory called 'standalone_scripts' somewhere in it causes the file to be stored separately instead of in scripts.js