Remove unused scripts

Is there an option to remove all unused scripts in the code? There is often a situation, where things get tested out but in the end rejected. I noticed, that all these scripts for these components stay in the code. That’s kind of messy. My download portal already has about 30 links and script includes. Many of them, I don’t have included in my page anymore.

Good idea - will put it in the Feature Requests


Thank you! This can be very handy since all these scripts really increase loading time of the page.

The only problem is to define when a script is “unused” ? It might get called somewhere on the page, but if you have includes it might be used in a include … so it is a bit difficult to determine when it is unused.

That’s true. Is there a way to backtrace to the SSIs and check if a script is needed there. If there is no need in the includes and the main page, it gets removed. But also only on command so not automatically. Kind of like your Shift-Tab where you can simplify the code format a bit.

Does some kind of check like this sound good - when you delete a component in app structure, then delete its includes in the head tags?

1 Like

Yeah something like that. Doesn’t have to be super smart, I’d already help if it just removed the includes on delete. But how does this go along with SSIs? Like a navbar which requires a certain script but it isn’t there any more because I removed a component with it’s include on the main page.

That’s the question we’re asking too :slight_smile:

So I’ve cleaned up most of the script includes manually and it’s already a lot faster. I dare to make the assertion that this could be one of the most important features. Because what’s more important than a fast loading page nowadays? My page already was very slow especially on mobiles.

So I’d say don’t let this function execute automatically after deleting an element. It would be a lot better to control it manually. This way, it could be more thorough and also search the SSIs without taking all the performance on every delete.

Also, sometimes components get added then removed than added again and so on. It would be better to enable the developer to draw a line and clean up his code at a certain point.

This is a good idea, just have to be aware to not create more problems than we are trying to solve. Automatic removal should be avoided in all costs. Maybe this could be an optional feature, but removing stuff from code without any warning is a source of big problems. Additionally we as developers users or whatever we need to control what is being added or deleted.