Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to determine what js files are being used by my WP Theme, to remove useless oens Re: How to determine what js files are being used by my WP Theme, to remove useless oens

#135784
Alen
Participant

You can concatenate your .js & .css files using Apache. [See line 510 on HTML5 Bolerplate, .htaccess](https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess) file!

Concatenating files is basically, adding the files together in the order they are required/loaded by the page. So let’s say you have 3 JavaScript files (jquery, slider, and functions).

So:

– jquery (1 request)

– slider (1 request)

– functions (1 request)


3 Total

Get merged into:

– app.js [jquery + slider + functions] (1 request)

> like if i just copy the contents of one js file, paste in another… then remove the old one.. things will still work?

Yes.

Same idea with CSS. One important thing to remember with both is to merge them in the right order.

If you are using WordPress you can conditionally load stuff you need. Let’s say you have a gallery page and you need to only load part of JavaScript needed.



Hope that helps,

-Alen