Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

drupal: so many js and css files?

I've realized I'm loading a lot of resources (24 css and 17 js files) using Drupal. I've several modules installed and they all come with a css and js file.

For my website I'm only using 1 additional js plugin (all the other 16 come with Drupal modules).

I've not installed useless modules. They are all necessary, and they require js such as swfobject, ajax_views, jquery.media, spamspan, lightbox (modal, video and default js files), etc

Same thing with css files: ckeditor, filefield, lightbox, tagadelic, uploadfield, fieldgroup, vews, taxonomy_super_select, html-element, tabs, messages... etc

For my website, I only use my theme css zen.css of course.

So.. is this normal ? Or I should remove all this stuff? Are drupal websites normally heavy ?

thanks

like image 496
aneuryzm Avatar asked May 08 '10 20:05

aneuryzm


People also ask

Does Drupal use CSS?

In Drupal, CSS stylesheets (CSS) and JavaScript (JS) are loaded through the same system for modules and themes as asset libraries. Drupal uses a high-level principle: assets (CSS or JS) are still only loaded if you tell Drupal it should load them.

How do I combine CSS and JS files?

Combine CSS To combine external CSS files, you can simply copy / paste all of your CSS code into one main file. Therefore all of the content from within the other CSS files will now reside within the main file allowing the browser to only make one request for a CSS file instead of multiple.

Can you combine CSS and JavaScript?

Combining CSS and JS files has historically been a popular method of improving a website's performance. By concatenating all of your files into one asset, you minimize the amount of calls that are being made to retrieve these assets from the web server.

Should I combine CSS files?

Combining CSS/JS files reduces the number of page requests, in turn reducing the number of round trips made to your server so that other resources can be retrieved faster. With HTTP/2, this is less of an issue as the protocol allows multiplexing, which allows requests and responses to be processed in parallel.


2 Answers

Count of js and css are not so big problem - you can enable optimizing css and js in Perfomance and get only 2 files (if there is not dynamical adding). If these files have too much size - may be solved via using compressing with special modules.

All of these recommend to enable on production site, not at development time.

like image 84
Nikit Avatar answered Oct 16 '22 09:10

Nikit


That's the problem with some content management systems: you get lots of overhead whether you need it all or not. If you remove items, the way the Drupal editor works will suffer or stop working.

If you're concerned with site loading speed, you can pull jQuery from Google: http://code.google.com/p/gempaq/wiki/Google_AJAX_API_for_Drupal and look into lots of different kinds of ways to speed load times here on SO Newest 'cdn' Questions - Stack Overflow and Best Practices for Speeding Up Your Web Site.

like image 37
markratledge Avatar answered Oct 16 '22 10:10

markratledge