0

I am using a bought theme for wordpress, which has multiple css and javascript (unfortunately). Something like 5-6 css files and 6-7 js files. I have tried some plugins that combine css/js files but it seems that those plugins make things worse. Actually it combines it okay, but some scripts become messy and even not working. What do you use for combining files in Wordpress? I have tried using: JS & CSS Script Optimizer.

Best, Simon

1 Answer 1

2

My suggestion would be to take a look at Grunt.

It is a Javascript Task runner that can be configured to do all kinds of things for you, like compiling Sass & Less, combining Javascript and CSS, minifying and so on. Depending on your experience it might take some time to get into, but in the long run it is worth it. There are a lot of great Tutorials, like this one that will get you started.

Side Note: You might already have a local Dev setup, but if not I strongly encourage you to set one up and only upload concatenated and minified files to Production, as I would not recommend running tasks like this on the live server.

Sign up to request clarification or add additional context in comments.

3 Comments

That is a good suggestion. I will definitely check Grunt out. Is it better generally to do it serverside rather than using plugins in wordpress?
This is a step that belongs to the development, or deployment process. I would always keep the production server / the live site as clean and reduced as possible.
This is fine to combine the files from your own team but it doesn't help the OP with his bought theme. It also doesn't help when 3th party plugins are injecting extra CSS files.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.