Forum Moderators: open

Message Too Old, No Replies

New Drupal 5.x site has 19 .css files and 8 .js files

on all pages

         

Future

9:44 am on Jun 2, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



We have first experience with drupal and request some expertise
Our new portal shows 19 .css files and 8.js files on all pages. (total 130 KB)
Is this normal or we need to tweak the code ?

Following .css files
advpoll.css
comment.css
content.css
date.css
defaults.css
fieldgroup.css
image_attach.css
nice_menus.css
nice_menus_default.css
node.css
poll.css
print.css
search.css
simplenews.css
style.css
system.css
timeentry.css
user.css
white.calendar.css

Following .js files
advpoll-vote.js
content.js
date_timezone.js
drupal.js
homepage.js
jquery.form.js
jquery.js
nice_menus.js

ergophobe

5:28 pm on Jun 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



These are mostly being added by modules, some perhaps as part of the theming.

There are a range of things you can do.

Simplest: enable caching. That will aggregate all those files into a single file and will gzip it if the client supports it and you're not already gzipping at the server level. That doesn't take care of redundancy and bloat, though.

Most complex: You basically remove the calls in the theme to include CSS and JS, you weed out all the rules/functions you don't actually need and you include just what you want. That's a lot of work and I wouldn't do it for the JS because you would miss out on updates, possibly related to security and stability, on those modules.

BradleyT

6:17 pm on Jun 3, 2009 (gmt 0)

10+ Year Member



Simplest: enable caching. That will aggregate all those files into a single file and will gzip it if the client supports it and you're not already gzipping at the server level. That doesn't take care of redundancy and bloat, though.

It's right below enable caching...

On the site performance page under
"Aggregate and compress CSS files:" click enabled. This creates 1 CSS file with a big long random character name and it contains all the css code so you won't have 19 http requests to your site.

Just remember that any CSS changes will need a new aggregated file created.

Future

9:05 pm on Jun 3, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thank You for your help ergophobe and BradleyY.

On modifying .js files this might lead to some security/stability issues, so we should not touch this at all. (can we minimize total number of .js files anyhow ?)

Modifying .css files, will this have an negative effects on performance ?

Our developer is being wrong, or I am posting queries wrong.

ergophobe

9:36 pm on Jun 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RE JS files - that's not what I meant. I meant that personally I would not mess around with the JS files that come included with modules, because then you would end up with issues if you upgrade the modules and if you don't upgrade, you can't take advantage of security fixes.

You can still aggregate the JS files like BradleyT said for the CSS files. Same thing. and like he said RE CSS, if you make changes, you need to remember to regenerate the aggregated file.

Modifying CSS files have negative effects on performance? I don't follow. I guess it would depend on what you do, but generally speaking no. Also generally speaking, aggregating the CSS files would help. Getting rid of redundant rules would help.

I am not actually sure that the aggregating thing is available in D5. BradleyT, do you know when that was introduced?

Anyway, modifying CSS is sort of the point and it's how your developer got your site to look the way he/you wanted. So I would say there's some miscommunication here somewhere along the line.

BradleyT

7:54 pm on Jun 8, 2009 (gmt 0)

10+ Year Member



It's in D5. I had it on for a while then a bunch of design requests started coming in so I turned it off. I didn't notice any apparent performance boost or loss though. If you take 10 seperate 5K files and make them into 1 single 50K file do you get a boost or a loss? On a web server you probably don't notice it when talking about watching a page load.

With 20 css files though I would probably test it - that's a lot of http requests.