MyBB Community Forums

Full Version: Javascript in themes alongside CSS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
You can attatch custom CSS to a theme in Admincp > Templates & Style > (Theme) > Add Stylesheet

I believe javascript has nearly the same importance as css these days. Possibly there could be a section added to include and edit javascript.

Similar to css, you have multiple js sheets and attach them to only the pages in which they are needed.

1. This is easier as you no longer need to fudge with uploading and managing URLs in headerinclude and elsewhere throughout templates.

2. It's easier to edit the javascript for users who don't use external clients and only access their files through FTP.

3. Theme creators no longer have to deal with inexperienced board owners panicking about why the dropdown menu on a theme isn't working.


The main goal here isn't to store the javascript in any different way. Temporary files could be made to store the added javascript. The main goal is basically ease of use.
I am actually liking your suggestion, I feel if we remove all inline js and all the js present inside script folder are shown like css(as you suggested), it will be quite easier to manage.
From a design POV, should this JavaScript be part of the template or theme?
A theme is simply a collection of options, templates, and style sheets. In this scenario, JavaScript files would just be another element of the theme.
I remember there being an idea like this bouncing around Discord, it is a good idea, but I'm curious how Wasm would tie in with this in a few years or so, perhaps that could be a problem for 1.12 / 2.0.
I agree that this should be implemented into new 1.10